diff --git a/clang/lib/Sema/SemaLookup.cpp b/clang/lib/Sema/SemaLookup.cpp index ed2f5e93d354..2aa1ee56402c 100644 --- a/clang/lib/Sema/SemaLookup.cpp +++ b/clang/lib/Sema/SemaLookup.cpp @@ -2546,7 +2546,7 @@ Sema::SpecialMemberOverloadResult *Sema::LookupSpecialMember(CXXRecordDecl *RD, // Now we perform lookup on the name we computed earlier and do overload // resolution. Lookup is only performed directly into the class since there // will always be a (possibly implicit) declaration to shadow any others. - OverloadCandidateSet OCS((SourceLocation())); + OverloadCandidateSet OCS(RD->getLocation()); DeclContext::lookup_result R = RD->lookup(Name); assert(!R.empty() && "lookup for a constructor or assignment operator was empty"); diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp index 71826d6799bb..8e1122aa43a5 100644 --- a/clang/lib/Sema/SemaTemplateDeduction.cpp +++ b/clang/lib/Sema/SemaTemplateDeduction.cpp @@ -2285,8 +2285,8 @@ Sema::DeduceTemplateArguments(ClassTemplatePartialSpecializationDecl *Partial, return Result; SmallVector DeducedArgs(Deduced.begin(), Deduced.end()); - InstantiatingTemplate Inst(*this, Partial->getLocation(), Partial, - DeducedArgs, Info); + InstantiatingTemplate Inst(*this, Info.getLocation(), Partial, DeducedArgs, + Info); if (Inst.isInvalid()) return TDK_InstantiationDepth; @@ -2449,8 +2449,8 @@ Sema::DeduceTemplateArguments(VarTemplatePartialSpecializationDecl *Partial, return Result; SmallVector DeducedArgs(Deduced.begin(), Deduced.end()); - InstantiatingTemplate Inst(*this, Partial->getLocation(), Partial, - DeducedArgs, Info); + InstantiatingTemplate Inst(*this, Info.getLocation(), Partial, DeducedArgs, + Info); if (Inst.isInvalid()) return TDK_InstantiationDepth; @@ -2535,8 +2535,8 @@ Sema::SubstituteExplicitTemplateArguments( // explicitly-specified template arguments against this function template, // and then substitute them into the function parameter types. SmallVector DeducedArgs(Deduced.begin(), Deduced.end()); - InstantiatingTemplate Inst(*this, FunctionTemplate->getLocation(), - FunctionTemplate, DeducedArgs, + InstantiatingTemplate Inst(*this, Info.getLocation(), FunctionTemplate, + DeducedArgs, ActiveTemplateInstantiation::ExplicitTemplateArgumentSubstitution, Info); if (Inst.isInvalid()) @@ -2789,8 +2789,8 @@ Sema::FinishTemplateArgumentDeduction(FunctionTemplateDecl *FunctionTemplate, // Enter a new template instantiation context while we instantiate the // actual function declaration. SmallVector DeducedArgs(Deduced.begin(), Deduced.end()); - InstantiatingTemplate Inst(*this, FunctionTemplate->getLocation(), - FunctionTemplate, DeducedArgs, + InstantiatingTemplate Inst(*this, Info.getLocation(), FunctionTemplate, + DeducedArgs, ActiveTemplateInstantiation::DeducedTemplateArgumentSubstitution, Info); if (Inst.isInvalid()) @@ -4624,8 +4624,7 @@ Sema::getMoreSpecializedPartialSpecialization( /*RefParamComparisons=*/0); if (Better1) { SmallVector DeducedArgs(Deduced.begin(),Deduced.end()); - InstantiatingTemplate Inst(*this, PS2->getLocation(), PS2, DeducedArgs, - Info); + InstantiatingTemplate Inst(*this, Loc, PS2, DeducedArgs, Info); Better1 = !::FinishTemplateArgumentDeduction( *this, PS2, PS1->getTemplateArgs(), Deduced, Info); } @@ -4640,8 +4639,7 @@ Sema::getMoreSpecializedPartialSpecialization( if (Better2) { SmallVector DeducedArgs(Deduced.begin(), Deduced.end()); - InstantiatingTemplate Inst(*this, PS1->getLocation(), PS1, DeducedArgs, - Info); + InstantiatingTemplate Inst(*this, Loc, PS1, DeducedArgs, Info); Better2 = !::FinishTemplateArgumentDeduction( *this, PS1, PS2->getTemplateArgs(), Deduced, Info); } @@ -4685,8 +4683,7 @@ Sema::getMoreSpecializedPartialSpecialization( if (Better1) { SmallVector DeducedArgs(Deduced.begin(), Deduced.end()); - InstantiatingTemplate Inst(*this, PS2->getLocation(), PS2, - DeducedArgs, Info); + InstantiatingTemplate Inst(*this, Loc, PS2, DeducedArgs, Info); Better1 = !::FinishTemplateArgumentDeduction(*this, PS2, PS1->getTemplateArgs(), Deduced, Info); @@ -4702,8 +4699,7 @@ Sema::getMoreSpecializedPartialSpecialization( /*RefParamComparisons=*/0); if (Better2) { SmallVector DeducedArgs(Deduced.begin(),Deduced.end()); - InstantiatingTemplate Inst(*this, PS1->getLocation(), PS1, - DeducedArgs, Info); + InstantiatingTemplate Inst(*this, Loc, PS1, DeducedArgs, Info); Better2 = !::FinishTemplateArgumentDeduction(*this, PS1, PS2->getTemplateArgs(), Deduced, Info); diff --git a/clang/test/SemaCXX/cxx98-compat.cpp b/clang/test/SemaCXX/cxx98-compat.cpp index 9690638ce025..2329295a5fa9 100644 --- a/clang/test/SemaCXX/cxx98-compat.cpp +++ b/clang/test/SemaCXX/cxx98-compat.cpp @@ -219,11 +219,11 @@ int n = {}; // expected-warning {{scalar initialized from empty initializer list class PrivateMember { struct ImPrivate {}; }; -template typename T::ImPrivate SFINAEAccessControl(T t) { // expected-warning {{substitution failure due to access control is incompatible with C++98}} expected-note {{while substituting deduced template arguments into function template 'SFINAEAccessControl' [with T = PrivateMember]}} +template typename T::ImPrivate SFINAEAccessControl(T t) { // expected-warning {{substitution failure due to access control is incompatible with C++98}} return typename T::ImPrivate(); } int SFINAEAccessControl(...) { return 0; } -int CheckSFINAEAccessControl = SFINAEAccessControl(PrivateMember()); +int CheckSFINAEAccessControl = SFINAEAccessControl(PrivateMember()); // expected-note {{while substituting deduced template arguments into function template 'SFINAEAccessControl' [with T = PrivateMember]}} template struct FriendRedefinition { diff --git a/clang/test/SemaCXX/implicit-member-functions.cpp b/clang/test/SemaCXX/implicit-member-functions.cpp index b5f7fe1016b9..de679fe14a06 100644 --- a/clang/test/SemaCXX/implicit-member-functions.cpp +++ b/clang/test/SemaCXX/implicit-member-functions.cpp @@ -58,13 +58,13 @@ namespace Recursion { }; struct B; struct A { + // expected-note@-1 {{while substituting deduced template arguments}} typedef B type; template::type> // expected-note@-1 {{in instantiation of template class}} A(const T &); // expected-note@-1 {{in instantiation of default argument}} - // expected-note@-2 {{while substituting deduced template arguments}} }; struct B { // expected-note {{candidate constructor (the implicit move }} B(); // expected-note {{candidate constructor not viable}} diff --git a/clang/test/SemaCXX/typo-correction.cpp b/clang/test/SemaCXX/typo-correction.cpp index 8dbedd2dc47f..85413566722b 100644 --- a/clang/test/SemaCXX/typo-correction.cpp +++ b/clang/test/SemaCXX/typo-correction.cpp @@ -282,13 +282,13 @@ namespace b6956809_test1 { namespace b6956809_test2 { template struct Err { typename T::error n; }; // expected-error{{type 'void *' cannot be used prior to '::' because it has no members}} struct S { - template typename Err::type method(T); // expected-note{{in instantiation of template class 'b6956809_test2::Err' requested here}} expected-note{{while substituting deduced template arguments into function template 'method' [with T = void *]}} + template typename Err::type method(T); // expected-note{{in instantiation of template class 'b6956809_test2::Err' requested here}} template int method(T *); }; void test() { S s; - int k = s.methodd((void*)0); // expected-error{{no member named 'methodd' in 'b6956809_test2::S'; did you mean 'method'?}} + int k = s.methodd((void*)0); // expected-error{{no member named 'methodd' in 'b6956809_test2::S'; did you mean 'method'?}} expected-note{{while substituting deduced template arguments into function template 'method' [with T = void *]}} } } diff --git a/clang/test/SemaTemplate/instantiate-exception-spec.cpp b/clang/test/SemaTemplate/instantiate-exception-spec.cpp index d4f12df22ec2..993ee8dfae1f 100644 --- a/clang/test/SemaTemplate/instantiate-exception-spec.cpp +++ b/clang/test/SemaTemplate/instantiate-exception-spec.cpp @@ -1,11 +1,9 @@ // RUN: %clang_cc1 -fsyntax-only -verify %s -// FIXME: the "note" should be down at the call site! -template void f1(T*) throw(T); // expected-error{{incomplete type 'Incomplete' is not allowed in exception specification}} \ - // expected-note{{instantiation of}} +template void f1(T*) throw(T); // expected-error{{incomplete type 'Incomplete' is not allowed in exception specification}} struct Incomplete; // expected-note{{forward}} void test_f1(Incomplete *incomplete_p, int *int_p) { f1(int_p); - f1(incomplete_p); + f1(incomplete_p); // expected-note{{instantiation of}} } diff --git a/clang/test/SemaTemplate/instantiate-function-params.cpp b/clang/test/SemaTemplate/instantiate-function-params.cpp index 5bfae537c04d..556a8181f043 100644 --- a/clang/test/SemaTemplate/instantiate-function-params.cpp +++ b/clang/test/SemaTemplate/instantiate-function-params.cpp @@ -7,12 +7,12 @@ template struct if_ { }; template struct wrap_constraints { }; template -inline char has_constraints_(Model* , // expected-note 2{{while substituting deduced template arguments into function template 'has_constraints_' [with }} \ - // expected-note 3{{candidate template ignored}} +inline char has_constraints_(Model* , // expected-note 3{{candidate template ignored}} wrap_constraints* = 0); // expected-note 2{{in instantiation}} template struct not_satisfied { - static const bool value = sizeof( has_constraints_((Model*)0) == 1); // expected-error 3{{no matching function}} + static const bool value = sizeof( has_constraints_((Model*)0) == 1); // expected-error 3{{no matching function}} \ + // expected-note 2{{while substituting deduced template arguments into function template 'has_constraints_' [with }} }; template struct requirement_; template struct instantiate { diff --git a/clang/test/SemaTemplate/instantiation-backtrace.cpp b/clang/test/SemaTemplate/instantiation-backtrace.cpp index f640836b7681..39dfb0b32a2f 100644 --- a/clang/test/SemaTemplate/instantiation-backtrace.cpp +++ b/clang/test/SemaTemplate/instantiation-backtrace.cpp @@ -39,13 +39,13 @@ namespace PR13365 { template typename ResultTy::error Deduce( void (T1::*member)(T2) ) {} // \ // expected-note {{instantiation of template class 'PR13365::ResultTy'}} \ - // expected-note {{substituting deduced template arguments into function template 'Deduce' [with T1 = PR13365::Cls, T2 = int &]}} \ // expected-note {{substitution failure [with T1 = PR13365::Cls, T2 = int &]}} struct Cls { void method(int&); }; void test() { - Deduce(&Cls::method); // expected-error {{no matching function}} + Deduce(&Cls::method); // expected-error {{no matching function}} \ + // expected-note {{substituting deduced template arguments into function template 'Deduce' [with T1 = PR13365::Cls, T2 = int &]}} } } diff --git a/clang/test/SemaTemplate/instantiation-depth-subst-2.cpp b/clang/test/SemaTemplate/instantiation-depth-subst-2.cpp index ef2a5c765d9c..c9df093b1f7a 100644 --- a/clang/test/SemaTemplate/instantiation-depth-subst-2.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-subst-2.cpp @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -verify %s -ftemplate-depth 2 template struct S { }; -template S operator+(T, T); // expected-error {{instantiation exceeded maximum depth}} expected-note 3{{while substituting}} +template S operator+(T, T); // expected-error {{instantiation exceeded maximum depth}} expected-note 2{{while substituting}} S<0> s; -int k = s + s; +int k = s + s; // expected-note {{while substituting}} diff --git a/clang/test/SemaTemplate/instantiation-depth-subst.cpp b/clang/test/SemaTemplate/instantiation-depth-subst.cpp index 06795f9514d3..2a3e422ac7af 100644 --- a/clang/test/SemaTemplate/instantiation-depth-subst.cpp +++ b/clang/test/SemaTemplate/instantiation-depth-subst.cpp @@ -3,7 +3,7 @@ // PR9793 template auto f(T t) -> decltype(f(t)); // \ // expected-error {{recursive template instantiation exceeded maximum depth of 2}} \ -// expected-note 3 {{while substituting}} +// expected-note 2 {{while substituting}} struct S {}; -int k = f(S{}); +int k = f(S{}); // expected-note {{while substituting}} diff --git a/clang/test/SemaTemplate/instantiation-order.cpp b/clang/test/SemaTemplate/instantiation-order.cpp index e058a5bc1873..9cac256ad458 100644 --- a/clang/test/SemaTemplate/instantiation-order.cpp +++ b/clang/test/SemaTemplate/instantiation-order.cpp @@ -5,11 +5,11 @@ template struct A { using X = typename T::X; }; // expected-error {{no members}} template typename T::X f(typename A::X); template void f(...) {} -template auto g(typename A::X) -> typename T::X; // expected-note {{here}} expected-note {{substituting}} +template auto g(typename A::X) -> typename T::X; // expected-note {{here}} template void g(...) {} void h() { f(0); // ok, SFINAE in return type - g(0); // not ok, substitution inside A is a hard error + g(0); // not ok, substitution inside A is a hard error // expected-note {{substituting}} } diff --git a/clang/test/SemaTemplate/operator-template.cpp b/clang/test/SemaTemplate/operator-template.cpp index 30d6ccfb9597..416625097064 100644 --- a/clang/test/SemaTemplate/operator-template.cpp +++ b/clang/test/SemaTemplate/operator-template.cpp @@ -12,7 +12,6 @@ int a0(A x) { return x == 1; } templatestruct B{typedef X Y;}; templatebool operator==(B*,typename B::Y); // \ // expected-error{{overloaded 'operator==' must have at least one parameter of class or enumeration type}} \ -// expected-note{{in instantiation of function template specialization}} \ // expected-note{{candidate template ignored: substitution failure [with X = int]}} -int a(B x) { return operator==(&x,1); } // expected-error{{no matching function for call to 'operator=='}} - +int a(B x) { return operator==(&x,1); } // expected-error{{no matching function for call to 'operator=='}} \ +// expected-note{{in instantiation of function template specialization}}