// unqualified lookup. This is useful when (for example) the
// original lookup would not have found something because it was a
// dependent name.
- DeclContext *DC = (SS.isEmpty() && !CallsUndergoingInstantiation.empty())
- ? CurContext : nullptr;
+ DeclContext *DC = SS.isEmpty() ? CurContext : nullptr;
while (DC) {
if (isa<CXXRecordDecl>(DC)) {
LookupQualifiedName(R, DC);
if (isInstance) {
Diag(R.getNameLoc(), diagnostic) << Name
<< FixItHint::CreateInsertion(R.getNameLoc(), "this->");
- UnresolvedLookupExpr *ULE = cast<UnresolvedLookupExpr>(
- CallsUndergoingInstantiation.back()->getCallee());
-
- CXXMethodDecl *DepMethod;
- if (CurMethod->isDependentContext()) {
- DepMethod = CurMethod;
- } else if (FunctionTemplateDecl *FTD =
- CurMethod->getPrimaryTemplate()) {
- // We have a member function template. It may be contained in a
- // class template. If so, get the original pattern for the member
- // function template. Otherwise, 'this' isn't dependent and we can
- // use CurMethod as is.
- if (FunctionTemplateDecl *MemberFTD =
- FTD->getInstantiatedFromMemberTemplate())
- DepMethod = cast<CXXMethodDecl>(MemberFTD->getTemplatedDecl());
- else
- DepMethod = CurMethod;
- } else {
- DepMethod = cast<CXXMethodDecl>(
- CurMethod->getInstantiatedFromMemberFunction());
- }
- assert(DepMethod && "No template pattern found");
-
- QualType DepThisType = DepMethod->getThisType(Context);
CheckCXXThisCapture(R.getNameLoc());
- CXXThisExpr *DepThis = new (Context) CXXThisExpr(
- R.getNameLoc(), DepThisType, false);
- TemplateArgumentListInfo TList;
- if (ULE->hasExplicitTemplateArgs())
- ULE->copyTemplateArgumentsInto(TList);
-
- CXXScopeSpec SS;
- SS.Adopt(ULE->getQualifierLoc());
- CXXDependentScopeMemberExpr *DepExpr =
- CXXDependentScopeMemberExpr::Create(
- Context, DepThis, DepThisType, true, SourceLocation(),
- SS.getWithLocInContext(Context),
- ULE->getTemplateKeywordLoc(), nullptr,
- R.getLookupNameInfo(),
- ULE->hasExplicitTemplateArgs() ? &TList : nullptr);
- CallsUndergoingInstantiation.back()->setCallee(DepExpr);
} else {
Diag(R.getNameLoc(), diagnostic) << Name;
}
QualType TransformSubstTemplateTypeParmPackType(TypeLocBuilder &TLB,
SubstTemplateTypeParmPackTypeLoc TL);
- ExprResult TransformCallExpr(CallExpr *CE) {
- getSema().CallsUndergoingInstantiation.push_back(CE);
- ExprResult Result =
- TreeTransform<TemplateInstantiator>::TransformCallExpr(CE);
- getSema().CallsUndergoingInstantiation.pop_back();
- return Result;
- }
-
ExprResult TransformLambdaExpr(LambdaExpr *E) {
LocalInstantiationScope Scope(SemaRef, /*CombineWithOuterScope=*/true);
return TreeTransform<TemplateInstantiator>::TransformLambdaExpr(E);
template <class T>
class A {
public:
- void f(T a) { }// expected-note {{must qualify identifier to find this declaration in dependent base class}}
- void g();// expected-note {{must qualify identifier to find this declaration in dependent base class}}
+ void f(T a) { }// expected-note 2{{must qualify identifier to find this declaration in dependent base class}}
+ void g();// expected-note 2{{must qualify identifier to find this declaration in dependent base class}}
};
template <class T>
public:
void z(T a)
{
- f(a); // expected-warning {{use of identifier 'f' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}}
- g(); // expected-warning {{use of identifier 'g' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}}
+ f(a); // expected-warning 2{{use of identifier 'f' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}}
+ g(); // expected-warning 2{{use of identifier 'g' found via unqualified lookup into dependent bases of class templates is a Microsoft extension}}
}
};
template class B<int>; // expected-note {{requested here}}
-template class B<char>;
+template class B<char>; // expected-note {{requested here}}
void test()
{