summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/checkers/misc-misplaced-const-cxx17.cpp
blob: 7816a091d7adb8c3af004141c8f6bf420e377c72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// RUN: %check_clang_tidy -expect-clang-tidy-error %s misc-misplaced-const %t -- -- -std=c++17

// This test previously would cause a failed assertion because the structured
// binding declaration had no valid type associated with it. This ensures the
// expected clang diagnostic is generated instead.
// CHECK-MESSAGES: :[[@LINE+1]]:6: error: decomposition declaration '[x]' requires an initializer [clang-diagnostic-error]
auto [x];

struct S { int a; };
S f();

int main() {
  auto [x] = f();
}

OpenPOWER on IntegriCloud