]> granicus.if.org Git - clang/commitdiff
Fix a bogus assertion after adjusting the type of a substituted
authorDouglas Gregor <dgregor@apple.com>
Fri, 5 Feb 2010 22:49:09 +0000 (22:49 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 5 Feb 2010 22:49:09 +0000 (22:49 +0000)
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

lib/Sema/SemaTemplateInstantiate.cpp
test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp

index ab66ef3dfdfaacaf5ee406b6220132ed4a2a1b08..c13b453c26ec5fa891c5c530cc0bda1f09806a39 100644 (file)
@@ -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()));
           }
 
index 74c7a855e284e7128e548da9850a6c09592a00ea..f74e78f746da06ea3cfd6bf32f627d15aad8adca 100644 (file)
@@ -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