It's an error to try to allocate an abstract object using new.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67542 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index b3d94c3..ac36a1f 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -238,6 +238,10 @@
if (CheckAllocatedType(AllocType, D))
return ExprError();
+ if (RequireNonAbstractType(D.getSourceRange().getBegin(), AllocType,
+ diag::err_allocation_of_abstract_type, 0))
+ return ExprError();
+
QualType ResultType = AllocType->isDependentType()
? Context.DependentTy
: Context.getPointerType(AllocType);