File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 1- // RUN: %clang_cc1 -std=c++23 -fsyntax-only -verify %s
1+ // RUN: %clang_cc1 -std=c++23 -fsyntax-only -Wimplicit-fallthrough - verify %s
22
33constexpr int f () { } // expected-warning {{non-void function does not return a value}}
44static_assert (__is_same(decltype ([] constexpr -> int { }( )), int )); // expected-warning {{non-void lambda does not return a value}}
@@ -10,4 +10,27 @@ namespace GH116485 {
1010int h () {
1111 if consteval { }
1212} // 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+
1336}
You can’t perform that action at this time.
0 commit comments