def err_unexpected_interface : Error<
"unexpected interface name %0: expected expression">;
def err_ref_non_value : Error<"%0 does not refer to a value">;
+def err_ref_vm_type : Error<
+ "cannot refer to declaration with a variably modified type inside block">;
def err_property_not_found : Error<
"property %0 not found on object of type %1">;
def err_duplicate_property : Error<
// as they do not get snapshotted.
//
if (CurBlock && ShouldSnapshotBlockValueReference(CurBlock, VD)) {
+ if (VD->getType().getTypePtr()->isVariablyModifiedType()) {
+ Diag(Loc, diag::err_ref_vm_type);
+ Diag(D->getLocation(), diag::note_declared_at);
+ return ExprError();
+ }
+
MarkDeclarationReferenced(Loc, VD);
QualType ExprTy = VD->getType().getNonReferenceType();
// The BlocksAttr indicates the variable is bound by-reference.
return x;
}
-
+// radr://7438948
+void test20() {
+ int n = 7;
+ int vla[n]; // expected-note {{declared at}}
+ int (*vm)[n] = 0; // expected-note {{declared at}}
+ vla[1] = 4341;
+ ^{
+ (void)vla[1]; // expected-error {{cannot refer to declaration with a variably modified type inside block}}
+ (void)(vm+1); // expected-error {{cannot refer to declaration with a variably modified type inside block}}
+ }();
+}