From: Douglas Gregor Date: Wed, 25 Mar 2009 21:23:52 +0000 (+0000) Subject: Fix notes regarding the instantiation of member classes (and test 'em). X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d048bb79f5c3b3751878aec038bce28a5ce0f439;p=clang Fix notes regarding the instantiation of member classes (and test 'em). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67708 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 60423f9f47..f6e36bf779 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -683,8 +683,7 @@ Sema::InstantiateClass(SourceLocation PointOfInstantiation, } Pattern = PatternDef; - InstantiatingTemplate Inst(*this, Instantiation->getLocation(), - Instantiation); + InstantiatingTemplate Inst(*this, PointOfInstantiation, Instantiation); if (Inst) return true; diff --git a/test/SemaTemplate/instantiate-member-class.cpp b/test/SemaTemplate/instantiate-member-class.cpp index 26fddcfb34..fab65cef2e 100644 --- a/test/SemaTemplate/instantiate-member-class.cpp +++ b/test/SemaTemplate/instantiate-member-class.cpp @@ -6,7 +6,7 @@ public: struct C { T &foo(); }; struct D { - struct E { T &bar(); }; + struct E { T &bar(); }; // expected-error{{cannot form a reference to 'void'}} struct F; // expected-note{{member is declared here}} }; }; @@ -31,3 +31,8 @@ void test_instantiation(X::C *x, f->foo(); // expected-error{{implicit instantiation of undefined member 'struct X::D::F'}} } + + +X::C *c3; // okay +X::D::E *e1; // okay +X::D::E e2; // expected-note{{in instantiation of member class 'struct X::D::E' requested here}}