[clang] 09517a9 - Add regression test from PR46487.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 10 15:55:37 PDT 2020


Author: Richard Smith
Date: 2020-08-10T15:55:27-07:00
New Revision: 09517a90682f05f13dca7d976aeaa5437beeb8f3

URL: https://github.com/llvm/llvm-project/commit/09517a90682f05f13dca7d976aeaa5437beeb8f3
DIFF: https://github.com/llvm/llvm-project/commit/09517a90682f05f13dca7d976aeaa5437beeb8f3.diff

LOG: Add regression test from PR46487.

The underlying crash here has already been fixed, presumably by ongoing
work on error recovery.

Added: 
    

Modified: 
    clang/test/SemaCXX/typo-correction.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/SemaCXX/typo-correction.cpp b/clang/test/SemaCXX/typo-correction.cpp
index e0325b3ba09b..8b13e43661ee 100644
--- a/clang/test/SemaCXX/typo-correction.cpp
+++ b/clang/test/SemaCXX/typo-correction.cpp
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions %s
-// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -std=c++20 %s
+// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -fcxx-exceptions %s
+// RUN: %clang_cc1 -fspell-checking-limit 0 -verify -Wno-c++11-extensions -fcxx-exceptions -std=c++20 %s
 
 namespace PR21817{
 int a(-rsing[2]); // expected-error {{undeclared identifier 'rsing'; did you mean 'using'?}}
@@ -745,3 +745,15 @@ void ns::create_test2() { // expected-error {{out-of-line definition of 'create_
 void ns::create_test() {
 }
 }
+
+namespace PR46487 {
+  bool g_var_bool; // expected-note {{here}}
+  const char g_volatile_char = 5; // expected-note {{here}}
+  // FIXME: We shouldn't suggest a typo-correction to 'g_var_bool' here,
+  // because it doesn't make the expression valid.
+  // expected-error at +2 {{did you mean 'g_var_bool'}}
+  // expected-error at +1 {{assigning to 'bool' from incompatible type 'void'}}
+  enum : decltype((g_var_long = throw))::a {
+    b = g_volatile_uchar // expected-error {{did you mean 'g_volatile_char'}}
+  };
+}


        


More information about the cfe-commits mailing list