[cfe-commits] r138648 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/SemaTemplate/temp_arg_nontype.cpp
Eli Friedman
eli.friedman at gmail.com
Fri Aug 26 13:28:18 PDT 2011
Author: efriedma
Date: Fri Aug 26 15:28:17 2011
New Revision: 138648
URL: http://llvm.org/viewvc/llvm-project?rev=138648&view=rev
Log:
Don't assert on taking the address of a non-type template parameter. Fixes PR10766.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=138648&r1=138647&r2=138648&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Fri Aug 26 15:28:17 2011
@@ -7417,7 +7417,7 @@
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");
}
Modified: cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp?rev=138648&r1=138647&r2=138648&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp (original)
+++ cfe/trunk/test/SemaTemplate/temp_arg_nontype.cpp Fri Aug 26 15:28:17 2011
@@ -320,3 +320,6 @@
}
}
+
+template <int& I> struct PR10766 { static int *ip; };
+template <int& I> int* PR10766<I>::ip = &I;
More information about the cfe-commits
mailing list