summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-03-23 17:49:10 +0000
committerAnders Carlsson <andersca@mac.com>2009-03-23 17:49:10 +0000
commit0d5ca29b7836d55a3a73f83d7e36b4bd35f8d85f (patch)
treece963ce70ddff4d1226de8d14643fe5e9c8ba5f0 /clang/lib/Sema/SemaDecl.cpp
parent893c2c963a5db7abddfa4b37e9d69f89131aafbd (diff)
downloadbcm5719-llvm-0d5ca29b7836d55a3a73f83d7e36b4bd35f8d85f.tar.gz
bcm5719-llvm-0d5ca29b7836d55a3a73f83d7e36b4bd35f8d85f.zip
It's an error to try to allocate an abstract object using new.
llvm-svn: 67542
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index bcb21c33ce9..c964daf6fd9 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1641,7 +1641,9 @@ Sema::ActOnVariableDeclarator(Scope* S, Declarator& D, DeclContext* DC,
}
// The variable can not have an abstract class type.
- if (RequireNonAbstractType(D.getIdentifierLoc(), R, 2 /* variable type */))
+ if (RequireNonAbstractType(D.getIdentifierLoc(), R,
+ diag::err_abstract_type_in_decl,
+ 2 /* variable type */))
InvalidDecl = true;
// The variable can not
@@ -1815,6 +1817,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// Check that the return type is not an abstract class type.
if (RequireNonAbstractType(D.getIdentifierLoc(),
R->getAsFunctionType()->getResultType(),
+ diag::err_abstract_type_in_decl,
0 /* return type */))
InvalidDecl = true;
@@ -1996,6 +1999,7 @@ Sema::ActOnFunctionDeclarator(Scope* S, Declarator& D, DeclContext* DC,
// Function parameters cannot have abstract class types.
if (RequireNonAbstractType(PVD->getLocation(), PVD->getType(),
+ diag::err_abstract_type_in_decl,
1 /* parameter type */))
InvalidDecl = true;
Params.push_back(PVD);
@@ -3534,7 +3538,8 @@ FieldDecl *Sema::CheckFieldDecl(DeclarationName Name, QualType T,
}
// Fields can not have abstract class types
- if (RequireNonAbstractType(Loc, T, 3 /* field type */))
+ if (RequireNonAbstractType(Loc, T, diag::err_abstract_type_in_decl,
+ 3 /* field type */))
InvalidDecl = true;
// If this is declared as a bit-field, check the bit-field.
OpenPOWER on IntegriCloud