]> granicus.if.org Git - clang/commitdiff
Don't assert on taking the address of a non-type template parameter. Fixes PR10766.
authorEli Friedman <eli.friedman@gmail.com>
Fri, 26 Aug 2011 20:28:17 +0000 (20:28 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Fri, 26 Aug 2011 20:28:17 +0000 (20:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138648 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/SemaTemplate/temp_arg_nontype.cpp

index e651f6dc2b74858898d4ab31e15407b5ecde329c..28ec97f6522893aabbcd72a07422d41c9e39ea1a 100644 (file)
@@ -7417,7 +7417,7 @@ static QualType CheckAddressOfOperand(Sema &S, Expr *OrigOp,
                 S.Context.getTypeDeclType(cast<RecordDecl>(Ctx)).getTypePtr());
         }
       }
-    } else if (!isa<FunctionDecl>(dcl))
+    } else if (!isa<FunctionDecl>(dcl) && !isa<NonTypeTemplateParmDecl>(dcl))
       assert(0 && "Unknown/unexpected decl type");
   }
 
index f90bb11f716ddb90d9b9c099c6e21347279d2e55..e93cfa3ebd5db7b4a9f072eb632812312a34dc2f 100644 (file)
@@ -320,3 +320,6 @@ namespace PR10579 {
   }
 
 }
+
+template <int& I> struct PR10766 { static int *ip; };
+template <int& I> int* PR10766<I>::ip = &I;