| 1 |
// RUN: %check_clang_tidy -expect-clang-tidy-error %s misc-misplaced-const %t -- -- -std=c++17 |
| 2 |
|
| 3 |
// This test previously would cause a failed assertion because the structured |
| 4 |
// binding declaration had no valid type associated with it. This ensures the |
| 5 |
// expected clang diagnostic is generated instead. |
| 6 |
// CHECK-MESSAGES: :[[@LINE+1]]:6: error: decomposition declaration '[x]' requires an initializer [clang-diagnostic-error] |
| 7 |
auto [x]; |
| 8 |
|
| 9 |
struct S { int a; }; |
| 10 |
S f(); |
| 11 |
|
| 12 |
int main() { |
| 13 |
auto [x] = f(); |
| 14 |
} |
| 15 |
|