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]
7auto [x];
8
9struct S { int a; };
10S f();
11
12int main() {
13 auto [x] = f();
14}
15
16

source code of clang-tools-extra/test/clang-tidy/checkers/misc/misplaced-const-cxx17.cpp