"variable length array declaration can not have 'static' storage duration">;
def err_vla_decl_has_extern_linkage : Error<
"variable length array declaration can not have 'extern' linkage">;
-
+
// C99 variably modified types
def err_variably_modified_template_arg : Error<
"variably modified type %0 cannot be used as a template argument">;
def err_variably_modified_nontype_template_param : Error<
"non-type template parameter of variably modified type %0">;
+def err_variably_modified_new_type : Error<
+ "'new' cannot allocate object of variably modified type %0">;
// C99 Designated Initializers
def err_array_designator_negative : Error<
MultiExprArg ConstructorArgs,
SourceLocation ConstructorRParen) {
SourceRange TypeRange = AllocTypeInfo->getTypeLoc().getSourceRange();
- if (CheckAllocatedType(AllocType, TypeRange.getBegin(), TypeRange))
- return ExprError();
// Per C++0x [expr.new]p5, the type being constructed may be a
// typedef of an array type.
}
}
+ if (CheckAllocatedType(AllocType, TypeRange.getBegin(), TypeRange))
+ return ExprError();
+
QualType ResultType = Context.getPointerType(AllocType);
// C++ 5.3.4p6: "The expression in a direct-new-declarator shall have integral
else if (RequireNonAbstractType(Loc, AllocType,
diag::err_allocation_of_abstract_type))
return true;
-
+ else if (AllocType->isVariablyModifiedType())
+ return Diag(Loc, diag::err_variably_modified_new_type)
+ << AllocType;
+
return false;
}