aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplateInstantiateDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-09-12 07:37:24 +0000
committerDouglas Gregor <dgregor@apple.com>2010-09-12 07:37:24 +0000
commitc6dbc3fa467e2355b678a6b717534928048efcb2 (patch)
tree9af1e43cf0a21228ac677e7e38773c9dc039cf8d /lib/Sema/SemaTemplateInstantiateDecl.cpp
parentda0fd9a7faa8b8a666e3c31ff0b5897e0f73f892 (diff)
Diagnose the instantiation of variables (including static data
members) with function type. Fixes PR8047. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplateInstantiateDecl.cpp')
-rw-r--r--lib/Sema/SemaTemplateInstantiateDecl.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplateInstantiateDecl.cpp b/lib/Sema/SemaTemplateInstantiateDecl.cpp
index b8690f6eb2..c97a8788ef 100644
--- a/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -349,6 +349,12 @@ Decl *TemplateDeclInstantiator::VisitVarDecl(VarDecl *D) {
if (!DI)
return 0;
+ if (DI->getType()->isFunctionType()) {
+ SemaRef.Diag(D->getLocation(), diag::err_variable_instantiates_to_function)
+ << D->isStaticDataMember() << DI->getType();
+ return 0;
+ }
+
// Build the instantiated declaration
VarDecl *Var = VarDecl::Create(SemaRef.Context, Owner,
D->getLocation(), D->getIdentifier(),