From: Eli Friedman Date: Fri, 26 Aug 2011 20:28:17 +0000 (+0000) Subject: Don't assert on taking the address of a non-type template parameter. Fixes PR10766. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7b2f51c758a14205f4c4215d7dc04a4cf3947b8a;p=clang Don't assert on taking the address of a non-type template parameter. Fixes PR10766. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138648 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index e651f6dc2b..28ec97f652 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -7417,7 +7417,7 @@ static QualType CheckAddressOfOperand(Sema &S, Expr *OrigOp, S.Context.getTypeDeclType(cast(Ctx)).getTypePtr()); } } - } else if (!isa(dcl)) + } else if (!isa(dcl) && !isa(dcl)) assert(0 && "Unknown/unexpected decl type"); } diff --git a/test/SemaTemplate/temp_arg_nontype.cpp b/test/SemaTemplate/temp_arg_nontype.cpp index f90bb11f71..e93cfa3ebd 100644 --- a/test/SemaTemplate/temp_arg_nontype.cpp +++ b/test/SemaTemplate/temp_arg_nontype.cpp @@ -320,3 +320,6 @@ namespace PR10579 { } } + +template struct PR10766 { static int *ip; }; +template int* PR10766::ip = &I;