[clang] 0260ea3 - [clang][Interp][NFC] Add test for e7f55bb

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 8 06:38:29 PDT 2023


Author: Timm Bäder
Date: 2023-04-08T15:28:47+02:00
New Revision: 0260ea3a5b1cfa0b0dbb9852742da7480fda620c

URL: https://github.com/llvm/llvm-project/commit/0260ea3a5b1cfa0b0dbb9852742da7480fda620c
DIFF: https://github.com/llvm/llvm-project/commit/0260ea3a5b1cfa0b0dbb9852742da7480fda620c.diff

LOG: [clang][Interp][NFC] Add test for e7f55bb

Added: 
    

Modified: 
    clang/test/AST/Interp/functions.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/Interp/functions.cpp b/clang/test/AST/Interp/functions.cpp
index 8b6b1bcd6f5c..933cc860577e 100644
--- a/clang/test/AST/Interp/functions.cpp
+++ b/clang/test/AST/Interp/functions.cpp
@@ -218,4 +218,17 @@ namespace InvalidCall {
                              // expected-note {{in call to}} \
                              // ref-error {{not an integral constant expression}} \
                              // ref-note {{in call to}}
+
+  /// This used to cause an assertion failure in the new constant interpreter.
+  constexpr void func(); // expected-note {{declared here}} \
+                         // ref-note {{declared here}}
+  struct SS {
+    constexpr SS() { func(); } // expected-note {{undefined function }} \
+                               // ref-note {{undefined function}}
+  };
+  constexpr SS ss; // expected-error {{must be initialized by a constant expression}} \
+                   // expected-note {{in call to 'SS()'}} \
+                   // ref-error {{must be initialized by a constant expression}} \
+                   // ref-note {{in call to 'SS()'}}
+
 }


        


More information about the cfe-commits mailing list