Record the entire type context for member references/instantiations
OpenPublic

zarko created this task.Via WebFri, Mar 31, 10:05 AM
zarko claimed this task.
zarko added a project: C++.
zarko added a subscriber: zarko.
Herald added a subscriber: Core Team. · View Herald TranscriptVia HeraldFri, Mar 31, 10:05 AM
zarko added a comment.Via WebFri, Mar 31, 10:27 AM

As a result of T229, we aren't able to distinguish between members of template instances that were implicitly instantiated at different types, e.g.:

template <typename T> class C { void f(); }
void g() {
  C<int> i;
  C<short> s;
  i.f();
  s.f();
}

i.f() and s.f() both ref and ref/call the same node, a unary tapp (tapp(C::f)). We used to point directly at C<int>::f or C<short>::f. (Attentive readers may recall a low-priority issue wrt the target of the instantiates edge starting at these members.)

In this situation, I think the best thing we can do is flatten out the type context (since the schema doesn't like nested tapps) and refer to tapp(C::f, int) and tapp(C::f, short). The head of the tapp should be the nearest explicit thing we can get at (like the closest partial specialization).

Add Comment