def err_array_of_abstract_type : Error<"array of abstract class type %0">;
def err_capture_of_abstract_type : Error<
"by-copy capture of value of abstract type %0">;
-def err_capture_of_incomplete_type : Error<
- "by-copy capture of variable %0 with incomplete type %1">;
+def err_capture_of_incomplete_or_sizeless_type : Error<
+ "by-copy capture of variable %0 with %select{incomplete|sizeless}1 type %2">;
def err_capture_default_non_local : Error<
"non-local lambda expression cannot have a capture-default">;
// Make sure that by-copy captures are of a complete and non-abstract type.
if (!Invalid && BuildAndDiagnose) {
if (!CaptureType->isDependentType() &&
- S.RequireCompleteType(Loc, CaptureType,
- diag::err_capture_of_incomplete_type,
- Var->getDeclName()))
+ S.RequireCompleteSizedType(
+ Loc, CaptureType,
+ diag::err_capture_of_incomplete_or_sizeless_type,
+ Var->getDeclName()))
Invalid = true;
else if (S.RequireNonAbstractType(Loc, CaptureType,
diag::err_capture_of_abstract_type))
#if __cplusplus >= 201703L
auto fn3 = [a(return_int8())] {}; // expected-error {{field has sizeless type '__SVInt8_t'}}
#endif
+ auto fn4 = [local_int8](svint8_t *ptr) { *ptr = local_int8; }; // expected-error {{by-copy capture of variable 'local_int8' with sizeless type 'svint8_t'}}
for (auto x : local_int8) { // expected-error {{no viable 'begin' function available}}
}