Author: Timm Bäder
Date: 2022-10-14T13:31:52+02:00
New Revision: 0e6901421247b1c7ce0a2e925666d5314a34fffa

URL: 
https://github.com/llvm/llvm-project/commit/0e6901421247b1c7ce0a2e925666d5314a34fffa
DIFF: 
https://github.com/llvm/llvm-project/commit/0e6901421247b1c7ce0a2e925666d5314a34fffa.diff

LOG: [clang][Interp][NFC] Add a failing test case

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/Interp/cxx20.cpp b/clang/test/AST/Interp/cxx20.cpp
index e088f6bafb7e..1b1a613b34b6 100644
--- a/clang/test/AST/Interp/cxx20.cpp
+++ b/clang/test/AST/Interp/cxx20.cpp
@@ -60,3 +60,21 @@ constexpr int unInitLocal() {
 static_assert(unInitLocal() == 0, ""); // expected-error {{not an integral 
constant expression}} \
                                        // ref-error {{not an integral constant 
expression}} \
                                        // ref-note {{in call to 
'unInitLocal()'}}
+
+/// TODO: The example above is correctly rejected by the new constexpr
+///   interpreter, but for the wrong reasons. We don't reject it because
+///   it is an uninitialized read, we reject it simply because
+///   the local variable does not have an initializer.
+///
+///   The code below should be accepted but is also being rejected
+///   right now.
+#if 0
+constexpr int initializedLocal() {
+  int a;
+  int b;
+
+  a = 20;
+  return a;
+}
+static_assert(initializedLocal() == 20);
+#endif


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to