DecompType.getQualifiers());
auto DiagnoseBadNumberOfBindings = [&]() -> bool {
- unsigned NumFields = std::distance(RD->field_begin(), RD->field_end());
+ unsigned NumFields =
+ std::count_if(RD->field_begin(), RD->field_end(),
+ [](FieldDecl *FD) { return !FD->isUnnamedBitfield(); });
assert(Bindings.size() != NumFields);
S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings)
<< DecompType << (unsigned)Bindings.size() << NumFields
(void) [n] {}; // expected-error {{'n' in capture list does not name a variable}}
}
+void bitfield() {
+ struct { int a : 3, : 4, b : 5; } a;
+ auto &[x, y] = a;
+ auto &[p, q, r] = a; // expected-error {{decomposes into 2 elements, but 3 names were provided}}
+}
+
// FIXME: by-value array copies