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