1 // RUN: %clang_cc1 -Wno-error=return-type -std=c++23 -fsyntax-only -Wimplicit-fallthrough -Wconsumed -verify %s 2 3 constexpr int f() { } // expected-warning {{non-void function does not return a value}} 4 static_assert(__is_same(decltype([] constexpr -> int { }( )), int)); // expected-warning {{non-void lambda does not return a value}} 5 6 consteval int g() { } // expected-warning {{non-void function does not return a value}} 7 static_assert(__is_same(decltype([] consteval -> int { }( )), int)); // expected-warning {{non-void lambda does not return a value}} 8 9 namespace GH116485 { 10 int h() { 11 if consteval { } 12 } // expected-warning {{non-void function does not return a value}} 13 14 void i(int x) { 15 if consteval { 16 } 17 switch (x) { 18 case 1: 19 i(1); 20 case 2: // expected-warning {{unannotated fall-through between switch labels}} \ 21 // expected-note {{insert 'break;' to avoid fall-through}} 22 break; 23 } 24 } 25 26 constexpr bool j() { 27 if !consteval { return true; } 28 } // expected-warning {{non-void function does not return a value in all control paths}} \ 29 // expected-note {{control reached end of constexpr function}} 30 31 bool k = j(); 32 constinit bool l = j(); // expected-error {{variable does not have a constant initializer}} \ 33 // expected-note {{required by 'constinit' specifier here}} \ 34 // expected-note {{in call to 'j()'}} 35 36 } 37 38 namespace GH117385 { 39 void f() { 40 if consteval { 41 } 42 } 43 } 44