| 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. |
| 4 | void 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 |
