llvm-project/clang/test/SemaCXX/decomposition-blocks.cpp
Shawn Zhong 82afc9b169 Fix -Wbitfield-constant-conversion on 1-bit signed bitfield
A one-bit signed bit-field can only hold the values 0 and -1; this
corrects the diagnostic behavior accordingly.

Fixes #53253
Differential Revision: https://reviews.llvm.org/D131255
2022-08-09 11:43:50 -04:00

15 lines
325 B
C++

// RUN: %clang_cc1 -std=c++17 -fsyntax-only -verify %s -fblocks
struct S {
int i : 1;
int j;
};
void run(void (^)());
void test() {
auto [i, j] = S{-1, 42}; // expected-note {{'i' declared here}}
run(^{
(void)i; // expected-error {{reference to local binding 'i' declared in enclosing function 'test'}}
});
}