[clang] [Clang] avoid adding consteval condition as the last statement to preserve valid CFG (PR #116513)

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 12:45:50 PST 2024


================
@@ -5,3 +5,9 @@ static_assert(__is_same(decltype([] constexpr -> int { }( )), int)); // expected
 
 consteval int g() { } // expected-warning {{non-void function does not return a value}}
 static_assert(__is_same(decltype([] consteval -> int { }( )), int)); // expected-warning {{non-void lambda does not return a value}}
+
+namespace GH116485 {
+int h() {
+    if consteval { }
+} // expected-warning {{non-void function does not return a value}}
----------------
a-tarasyuk wrote:

@AaronBallman thanks for the feedback. I’ve added tests, and the first one works as expected. Could you check the last one to see if I need to add any extra handling for that case?

https://github.com/llvm/llvm-project/pull/116513


More information about the cfe-commits mailing list