Index: clang/lib/Sema/SemaTemplateInstantiateDecl.cpp =================================================================== --- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -4234,8 +4234,10 @@ // unimported module. Function->setVisibleDespiteOwningModule(); - // Copy the inner loc start from the pattern. + // Copy source locations from the pattern. + Function->setLocation(PatternDecl->getLocation()); Function->setInnerLocStart(PatternDecl->getInnerLocStart()); + Function->setRangeEnd(PatternDecl->getEndLoc()); EnterExpressionEvaluationContext EvalContext( *this, Sema::ExpressionEvaluationContext::PotentiallyEvaluated); Index: clang/test/SemaCXX/member-init.cpp =================================================================== --- clang/test/SemaCXX/member-init.cpp +++ clang/test/SemaCXX/member-init.cpp @@ -164,11 +164,11 @@ namespace explicit_instantiation { template struct X { - X(); // expected-note {{in instantiation of default member initializer 'explicit_instantiation::X::n' requested here}} + X(); int n = T::error; // expected-error {{type 'float' cannot be used prior to '::' because it has no members}} }; template struct X; // ok -template X::X() {} +template X::X() {} // expected-note {{in instantiation of default member initializer 'explicit_instantiation::X::n' requested here}} template struct X; // expected-note {{in instantiation of member function 'explicit_instantiation::X::X' requested here}} } Index: clang/test/SemaTemplate/virtual-member-functions.cpp =================================================================== --- clang/test/SemaTemplate/virtual-member-functions.cpp +++ clang/test/SemaTemplate/virtual-member-functions.cpp @@ -7,10 +7,10 @@ namespace PR5557 { template struct A { - A(); // expected-note{{instantiation}} + A(); virtual int a(T x); }; -template A::A() {} +template A::A() {} // expected-note{{instantiation}} template int A::a(T x) { return *x; // expected-error{{requires pointer operand}} @@ -33,10 +33,10 @@ namespace PR5557_dtor { template struct A { A(); // Don't have an implicit constructor. - ~A(); // expected-note{{instantiation}} + ~A(); virtual int a(T x); }; -template A::~A() {} +template A::~A() {} // expected-note{{instantiation}} template int A::a(T x) { return *x; // expected-error{{requires pointer operand}}