summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Sema/CodeCompleteTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/unittests/Sema/CodeCompleteTest.cpp')
-rw-r--r--clang/unittests/Sema/CodeCompleteTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Sema/CodeCompleteTest.cpp b/clang/unittests/Sema/CodeCompleteTest.cpp
index ab1792ba637..a9441a679ca 100644
--- a/clang/unittests/Sema/CodeCompleteTest.cpp
+++ b/clang/unittests/Sema/CodeCompleteTest.cpp
@@ -481,4 +481,12 @@ TEST(PreferredTypeTest, FunctionArguments) {
)cpp";
EXPECT_THAT(collectPreferredTypes(Code), Each("vector<int>"));
}
+
+TEST(PreferredTypeTest, NoCrashOnInvalidTypes) {
+ StringRef Code = R"cpp(
+ auto x = decltype(&1)(^);
+ auto y = new decltype(&1)(^);
+ )cpp";
+ EXPECT_THAT(collectPreferredTypes(Code), Each("NULL TYPE"));
+}
} // namespace
OpenPOWER on IntegriCloud