aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-05 22:49:09 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-05 22:49:09 +0000
commite41ac7b007d64b504f8e79b97839d060a3669171 (patch)
treebbc353793c5fabe5e7e3b189c771b7f0ca4bee14
parent8b013bdbf6474ed25d4017635cac851e51163c25 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95447 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp4
-rw-r--r--test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp6
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index ab66ef3dfd..c13b453c26 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -791,7 +791,9 @@ TemplateInstantiator::TransformDeclRefExpr(DeclRefExpr *E) {
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()));
}
diff --git a/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp b/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
index 74c7a855e2..f74e78f746 100644
--- a/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
+++ b/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
@@ -46,6 +46,12 @@ namespace pointer_to_object_parameters {
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