[cfe-commits] r96084 - in /cfe/trunk: lib/Sema/TreeTransform.h test/SemaTemplate/typename-specifier-4.cpp
Douglas Gregor
dgregor at apple.com
Fri Feb 12 22:05:41 PST 2010
Author: dgregor
Date: Sat Feb 13 00:05:33 2010
New Revision: 96084
URL: http://llvm.org/viewvc/llvm-project?rev=96084&view=rev
Log:
Fix a fiendinshly fun little type-canonicalization bug, where we were
rebuilding a typename type terminating in a template-id (with
dependent template name, naturally) as a TypenameType when, because
its context could be fully resolved, we should have been building it
as a QualifiedNameType. Fixes PR6268.
Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp
Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=96084&r1=96083&r2=96084&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Sat Feb 13 00:05:33 2010
@@ -525,9 +525,13 @@
/// and the given type. Subclasses may override this routine to provide
/// different behavior.
QualType RebuildTypenameType(NestedNameSpecifier *NNS, QualType T) {
- if (NNS->isDependent())
- return SemaRef.Context.getTypenameType(NNS,
+ if (NNS->isDependent()) {
+ CXXScopeSpec SS;
+ SS.setScopeRep(NNS);
+ if (!SemaRef.computeDeclContext(SS))
+ return SemaRef.Context.getTypenameType(NNS,
cast<TemplateSpecializationType>(T));
+ }
return SemaRef.Context.getQualifiedNameType(NNS, T);
}
Modified: cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp?rev=96084&r1=96083&r2=96084&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp (original)
+++ cfe/trunk/test/SemaTemplate/typename-specifier-4.cpp Sat Feb 13 00:05:33 2010
@@ -80,3 +80,22 @@
}
};
}
+
+namespace PR6268 {
+ template <typename T>
+ struct Outer {
+ template <typename U>
+ struct Inner {};
+
+ template <typename U>
+ typename Outer<T>::template Inner<U>
+ foo(typename Outer<T>::template Inner<U>);
+ };
+
+ template <typename T>
+ template <typename U>
+ typename Outer<T>::template Inner<U>
+ Outer<T>::foo(typename Outer<T>::template Inner<U>) {
+ return Inner<U>();
+ }
+}
More information about the cfe-commits
mailing list