diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-12-03 18:33:45 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-12-03 18:33:45 +0000 |
commit | c99f1553652aa099c26e1c7695b59aeeb18c54c5 (patch) | |
tree | 0170a6eea5f9e1d52e666408c5de8b42fbb7c8f0 /clang/lib/Sema/SemaDecl.cpp | |
parent | 2a3dbb57496d1d970664ce9ca6ddce71c126ecd5 (diff) | |
download | bcm5719-llvm-c99f1553652aa099c26e1c7695b59aeeb18c54c5.tar.gz bcm5719-llvm-c99f1553652aa099c26e1c7695b59aeeb18c54c5.zip |
Unify the end-of-class code paths used by the parser and template
instantiation, to ensure that we mark class template specilizations as
abstract when we need to and perform checking of abstract classes.
Also, move the checking that determines whether we are creating a
variable of abstract class type *after* we check whether the type is
complete. Otherwise, we won't see when we have an abstract class
template specialization that is implicitly instantiated by this
declaration. This is the "something else" that Sebastian had noted
earlier.
llvm-svn: 90467
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 5a7d0060433..ea5e47a9a34 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -2444,12 +2444,6 @@ void Sema::CheckVariableDeclaration(VarDecl *NewVD, return NewVD->setInvalidDecl(); } - // The variable can not have an abstract class type. - if (RequireNonAbstractType(NewVD->getLocation(), T, - diag::err_abstract_type_in_decl, - AbstractVariableType)) - return NewVD->setInvalidDecl(); - // Emit an error if an address space was applied to decl with local storage. // This includes arrays of objects with address space qualifiers, but not // automatic variables that point to other address spaces. @@ -3431,6 +3425,12 @@ void Sema::AddInitializerToDecl(DeclPtrTy dcl, ExprArg init, bool DirectInit) { return; } + // The variable can not have an abstract class type. + if (RequireNonAbstractType(VDecl->getLocation(), VDecl->getType(), + diag::err_abstract_type_in_decl, + AbstractVariableType)) + VDecl->setInvalidDecl(); + const VarDecl *Def = 0; if (VDecl->getDefinition(Def)) { Diag(VDecl->getLocation(), diag::err_redefinition) @@ -3663,6 +3663,12 @@ void Sema::ActOnUninitializedDecl(DeclPtrTy dcl, Var->setInvalidDecl(); } } + + // The variable can not have an abstract class type. + if (RequireNonAbstractType(Var->getLocation(), Type, + diag::err_abstract_type_in_decl, + AbstractVariableType)) + Var->setInvalidDecl(); } #if 0 |