diff options
author | Anders Carlsson <andersca@mac.com> | 2009-06-24 00:28:53 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-06-24 00:28:53 +0000 |
commit | e98da2e7af16056a53db327b520d4b53b4be5e7a (patch) | |
tree | ca235340c55c03cafbd70bd33347241cf1e97848 /lib/Sema/SemaDecl.cpp | |
parent | c5c903acd805581dc7ef881f7cb8df38afca4468 (diff) |
Support for [class.local]p4.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@74030 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r-- | lib/Sema/SemaDecl.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 48d1d64de1..7c4cb60fd5 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -1807,6 +1807,15 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC, } else if (SC == VarDecl::None) SC = VarDecl::Static; } + if (SC == VarDecl::Static) { + if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(DC)) { + if (RD->isLocalClass()) + Diag(D.getIdentifierLoc(), + diag::err_static_data_member_not_allowed_in_local_class) + << Name << RD->getDeclName(); + } + } + // The variable can not NewVD = VarDecl::Create(Context, DC, D.getIdentifierLoc(), |