This is an archive of the discontinued LLVM Phabricator instance.

[Sema] PR26077 Fix assert when partial specialization is missing required parameters
AbandonedPublic

Authored by hintonda on Feb 7 2016, 11:10 AM.

Details

Reviewers
rsmith
Summary

Bail-out and return true as soon as a partial template specialization that does not use any of its template parameters is detected.

This avoids an asset later on since the ctor doesn't depend on any parameters and Sema::SetCtorInitializers doesn't return early.

Event Timeline

hintonda updated this revision to Diff 47142.Feb 7 2016, 11:10 AM
hintonda retitled this revision from to Fixed crash when partial specialization is missing required parameters.
hintonda updated this object.
hintonda added reviewers: doug.gregor, lvoufo.
hintonda added a subscriber: cfe-commits.
hintonda added a comment.EditedFeb 7 2016, 11:16 AM

Here's a snippet of code that will crash:

class DB {};

template <typename T> class RemovePolicy : public T {};

template <typename T, typename Policy = RemovePolicy<T>>

class Crash : T, Policy {};

template <typename Policy>
class Crash<DB/*, Policy*/> : public DB, public Policy {
public:

Crash(){}

};

hintonda updated this revision to Diff 47499.Feb 10 2016, 11:51 AM
  • Added test for PR26077

I don't have commit access, so if this patch is accepted, could someone please commit it for me?

hintonda retitled this revision from Fixed crash when partial specialization is missing required parameters to [Sema] PR26077 Fixed crash when partial specialization is missing required parameters.Feb 13 2016, 8:17 AM
hintonda updated this revision to Diff 102292.Jun 12 2017, 9:01 PM

Rebase, fix test, and add FIXME note.

hintonda retitled this revision from [Sema] PR26077 Fixed crash when partial specialization is missing required parameters to [Sema] PR26077 Fix assert when partial specialization is missing required parameters.Jul 13 2017, 8:43 AM
hintonda edited the summary of this revision. (Show Details)
hintonda abandoned this revision.Apr 23 2020, 11:41 AM