summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/test/clang-tidy/misc-misplaced-const-cxx17.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2018-03-02 19:14:34 +0000
committerAaron Ballman <aaron@aaronballman.com>2018-03-02 19:14:34 +0000
commitada5234b6ee64579ef42f0e5a7df10d335235acb (patch)
tree649cd7e177df6c336c675afff66f55f7c62cbe35 /clang-tools-extra/test/clang-tidy/misc-misplaced-const-cxx17.cpp
parent66a9268a2a11d445c13ac0f02464407fb01ada18 (diff)
downloadbcm5719-llvm-ada5234b6ee64579ef42f0e5a7df10d335235acb.tar.gz
bcm5719-llvm-ada5234b6ee64579ef42f0e5a7df10d335235acb.zip
Adds a clang-tidy test for a failing assertion in the misc-misplaced-const check.
The test case previously triggered an assertion in the AST matchers because the QualType being matched is invalid. That is no longer the case after r326604. llvm-svn: 326605
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/misc-misplaced-const-cxx17.cpp')
-rw-r--r--clang-tools-extra/test/clang-tidy/misc-misplaced-const-cxx17.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang-tools-extra/test/clang-tidy/misc-misplaced-const-cxx17.cpp b/clang-tools-extra/test/clang-tidy/misc-misplaced-const-cxx17.cpp
new file mode 100644
index 00000000000..d9213cea601
--- /dev/null
+++ b/clang-tools-extra/test/clang-tidy/misc-misplaced-const-cxx17.cpp
@@ -0,0 +1,15 @@
+// RUN: %check_clang_tidy %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