[cfe-commits] r131383 - in /cfe/trunk: lib/Sema/SemaCXXScopeSpec.cpp lib/Sema/SemaTemplate.cpp test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
Douglas Gregor
dgregor at apple.com
Sun May 15 10:27:28 PDT 2011
Author: dgregor
Date: Sun May 15 12:27:27 2011
New Revision: 131383
URL: http://llvm.org/viewvc/llvm-project?rev=131383&view=rev
Log:
When checking a set of template parameter lists against a
nested-name-specifier, re-evaluate the nested-name-specifier as if we
were entering that context (which we did!), so that we'll resolve a
template-id to a particular class template partial
specialization. Fixes PR9913.
Modified:
cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=131383&r1=131382&r2=131383&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Sun May 15 12:27:27 2011
@@ -423,7 +423,7 @@
// class-name or namespace-name. [...]
//
// Qualified name lookup into a class will not find a namespace-name,
- // so we do not need to diagnoste that case specifically. However,
+ // so we do not need to diagnose that case specifically. However,
// this qualified name lookup may find nothing. In that case, perform
// unqualified name lookup in the given scope (if available) or
// reconstruct the result from when name lookup was performed at template
Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=131383&r1=131382&r2=131383&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Sun May 15 12:27:27 2011
@@ -1513,8 +1513,13 @@
// by the nested-name-specifier and walking out until we run out of types.
llvm::SmallVector<QualType, 4> NestedTypes;
QualType T;
- if (SS.getScopeRep())
- T = QualType(SS.getScopeRep()->getAsType(), 0);
+ if (SS.getScopeRep()) {
+ if (CXXRecordDecl *Record
+ = dyn_cast_or_null<CXXRecordDecl>(computeDeclContext(SS, true)))
+ T = Context.getTypeDeclType(Record);
+ else
+ T = QualType(SS.getScopeRep()->getAsType(), 0);
+ }
// If we found an explicit specialization that prevents us from needing
// 'template<>' headers, this will be set to the location of that
Modified: cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp?rev=131383&r1=131382&r2=131383&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.spec/temp.expl.spec/examples.cpp Sun May 15 12:27:27 2011
@@ -166,3 +166,13 @@
template<> const int X<1>::Y::Z; // expected-error{{extraneous 'template<>' in declaration of variable 'Z'}}
}
+namespace PR9913 {
+ template<class,class=int>struct S;
+ template<class X>struct S<X> {
+ template<class T> class F;
+ };
+
+ template<class A>
+ template<class B>
+ class S<A>::F{};
+}
More information about the cfe-commits
mailing list