Page MenuHomePhabricator

[Sema] Map from a variable template specialization in a pattern to a variable template specialization in an instantiation properly

Authored by erik.pilkington on Jul 26 2019, 5:02 PM.



Previously, when instantiating S<int>::mf below, we would emit a reference to the declaration of S<T2>::v<char>, when we really ought to make a new declaration for v in the template instantiation. This caused a variety of problems, since the variable template specialization that we were using was in a dependent context. The fix is to teach FindInstantiatedDecl to map the variable instantiation from the pattern to the instantiation.


template <class T2>
struct S {
  template <class T1>
  static constexpr int v = 0;

  void mf() { v<char>; }

S<int> x;

Thanks for taking a look!

Diff Detail


Event Timeline

rsmith accepted this revision.Jul 26 2019, 5:14 PM
This revision is now accepted and ready to land.Jul 26 2019, 5:14 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 30 2019, 4:39 PM