1// RUN: %check_clang_tidy %s readability-else-after-return %t -- -- -std=c++17
2
3// Constexpr if is an exception to the rule, we cannot remove the else.
4void f() {
5 if (sizeof(int) > 4)
6 return;
7 else
8 return;
9 // CHECK-MESSAGES: [[@LINE-2]]:3: warning: do not use 'else' after 'return'
10
11 if constexpr (sizeof(int) > 4)
12 return;
13 else
14 return;
15
16 if constexpr (sizeof(int) > 4)
17 return;
18 else if constexpr (sizeof(long) > 4)
19 return;
20 else
21 return;
22}
23

source code of clang-tools-extra/test/clang-tidy/checkers/readability/else-after-return-if-constexpr.cpp