[cfe-commits] r152189 - in /cfe/trunk: lib/AST/ASTContext.cpp test/SemaTemplate/temp_arg_template.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Mar 6 17:09:34 PST 2012
Author: efriedma
Date: Tue Mar 6 19:09:33 2012
New Revision: 152189
URL: http://llvm.org/viewvc/llvm-project?rev=152189&view=rev
Log:
Make sure we consistently canonicalize types when canonicalizing TemplateTemplateParmDecls. PR12179.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/SemaTemplate/temp_arg_template.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=152189&r1=152188&r2=152189&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Tue Mar 6 19:09:33 2012
@@ -74,12 +74,14 @@
if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(*P)) {
ID.AddInteger(1);
ID.AddBoolean(NTTP->isParameterPack());
- ID.AddPointer(NTTP->getType().getAsOpaquePtr());
+ ID.AddPointer(NTTP->getType().getCanonicalType().getAsOpaquePtr());
if (NTTP->isExpandedParameterPack()) {
ID.AddBoolean(true);
ID.AddInteger(NTTP->getNumExpansionTypes());
- for (unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I)
- ID.AddPointer(NTTP->getExpansionType(I).getAsOpaquePtr());
+ for (unsigned I = 0, N = NTTP->getNumExpansionTypes(); I != N; ++I) {
+ QualType T = NTTP->getExpansionType(I);
+ ID.AddPointer(T.getCanonicalType().getAsOpaquePtr());
+ }
} else
ID.AddBoolean(false);
continue;
Modified: cfe/trunk/test/SemaTemplate/temp_arg_template.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_arg_template.cpp?rev=152189&r1=152188&r2=152189&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_arg_template.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_arg_template.cpp Tue Mar 6 19:09:33 2012
@@ -54,3 +54,9 @@
void f0( Y<int,1> y){ 1 << y; } // expected-note{{in instantiation of function template specialization 'N::operator<<<Y, int, 1>' requested here}}
}
+
+// PR12179
+template <typename Primitive, template <Primitive...> class F>
+struct unbox_args {
+ typedef typename Primitive::template call<F> x;
+};
More information about the cfe-commits
mailing list