llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Timm Baeder (tbaederr)

<details>
<summary>Changes</summary>

We need to handle the missing TargetLabel here, similarly to what we do in 
break statements.

---
Full diff: https://github.com/llvm/llvm-project/pull/216547.diff


2 Files Affected:

- (modified) clang/lib/AST/ByteCode/Compiler.cpp (+3-1) 
- (modified) clang/test/AST/ByteCode/cxx23.cpp (+13) 


``````````diff
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index bfb5df69b0e3a..a8e2cb4a3c076 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -7023,7 +7023,9 @@ bool Compiler<Emitter>::visitContinueStmt(const 
ContinueStmt *S) {
       }
     }
   }
-  assert(TargetLabel);
+
+  if (!TargetLabel)
+    return false;
 
   for (VariableScope<Emitter> *C = VarScope; C != ContinueScope;
        C = C->getParent()) {
diff --git a/clang/test/AST/ByteCode/cxx23.cpp 
b/clang/test/AST/ByteCode/cxx23.cpp
index 5607ec9b59cb5..17a4277205f86 100644
--- a/clang/test/AST/ByteCode/cxx23.cpp
+++ b/clang/test/AST/ByteCode/cxx23.cpp
@@ -650,6 +650,19 @@ namespace DynamicCast {
 }
 
 #if __cplusplus >= 202302L
+namespace BrokenContinueLabel {
+  constexpr int test() {
+  bar: {} // all-note {{here}}
+  bar: // all-error {{redefinition of label 'bar'}}
+    for (;;) {
+      continue bar; // all-error {{only supported in C2y}}
+    }
+    return 0;
+  }
+
+  static_assert(test(), ""); // all-error {{not an integral constant 
expression}}
+}
+
 namespace BrokenShuffleVector {
   typedef float __m128 __attribute__((__vector_size__(16)));
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/216547
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to