1 // RUN: %clang_cc1 -std=c++17 -fcxx-exceptions -fexceptions -fsyntax-only -Wunreachable-code-aggressive -fblocks -verify %s
8 ++i
) { // expected-warning {{loop will run at most once (loop increment never executed)}}
9 if (j
== 23) // missing {}'s
14 return 1; // expected-warning {{will never be executed}}
20 ++i
) { // expected-warning {{loop will run at most once (loop increment never executed)}}
21 if (j
== 23) // missing {}'s
26 return bar(); // expected-warning {{will never be executed}}
33 bar(); // expected-warning {{will never be executed}}
39 bar(); // expected-warning {{will never be executed}}
42 bar(); // expected-warning {{will never be executed}}
47 bar(); // expected-warning {{will never be executed}}
51 bar(); // expected-warning {{will never be executed}}
55 // PR 6130 - Don't warn about bogus unreachable code with throw's and
63 int pr6130(unsigned i
) {
68 throw PR6130(); // no-warning
72 extern "C" void foo(void);
73 extern "C" __attribute__((weak
)) decltype(foo
) foo
;
86 if (a
> 4) [[ likely
]] { // no-warning
90 if (a
> 4) [[ unlikely
]] { // no-warning
93 return; // expected-warning {{will never be executed}}
96 [[clang::musttail
]] return g(a
); // no-warning
98 [[clang::musttail
]] return g(a
); // expected-warning {{will never be executed}}
105 if constexpr (true) {
109 return false; // expected-warning {{will never be executed}}
112 return false; // no-warning
119 return false; // expected-warning {{will never be executed}}
129 return false; // expected-warning {{will never be executed}}