[cfe-commits] r95447 - in /cfe/trunk: lib/Sema/SemaTemplateInstantiate.cpp test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
Douglas Gregor
dgregor at apple.com
Fri Feb 5 14:49:10 PST 2010
Author: dgregor
Date: Fri Feb 5 16:49:09 2010
New Revision: 95447
URL: http://llvm.org/viewvc/llvm-project?rev=95447&view=rev
Log:
Fix a bogus assertion after adjusting the type of a substituted
non-type template argument for a non-type template parameter of
pointer type. Fixes PR6244.
Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=95447&r1=95446&r2=95447&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Feb 5 16:49:09 2010
@@ -791,7 +791,9 @@
return SemaRef.ExprError();
RefE = (Expr *)RefExpr.get();
- assert(SemaRef.IsQualificationConversion(RefE->getType(),
+ assert(SemaRef.Context.hasSameUnqualifiedType(RefE->getType(),
+ NTTP->getType()) ||
+ SemaRef.IsQualificationConversion(RefE->getType(),
NTTP->getType()));
}
Modified: cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp?rev=95447&r1=95446&r2=95447&view=diff
==============================================================================
--- cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp (original)
+++ cfe/trunk/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp Fri Feb 5 16:49:09 2010
@@ -46,6 +46,12 @@
A2<array_of_Xs> *a13;
A2<&an_X> *a13_2;
A2<(&an_X)> *a13_3; // expected-error{{non-type template argument cannot be surrounded by parentheses}}
+
+ // PR6244
+ struct X1 {} X1v;
+ template <X1*> struct X2 { };
+ template <X1* Value> struct X3 : X2<Value> { };
+ struct X4 : X3<&X1v> { };
}
// -- For a non-type template-parameter of type reference to object, no
More information about the cfe-commits
mailing list