Debian Codegraph @

clang-tools-extra/test/clang-tidy/checkers/readability/misleading-indentation-cpp17.cpp

raw
1 // RUN: %check_clang_tidy -std=c++17-or-later %s readability-misleading-indentation %t -- -- -fno-delayed-template-parsing
2
3 namespace PR61435 {
4
5 template<int N>
6 constexpr auto lam_correct = []{
7 if constexpr (N == 1) {
8 } else {
9 }
10 };
11
12 template<int N>
13 constexpr auto lam_incorrect = []{
14 if constexpr (N == 1) {
15 }
16 else {
17 }
18 // CHECK-MESSAGES: :[[@LINE-2]]:4: warning: different indentation for 'if' and corresponding 'else' [readability-misleading-indentation]
19 };
20
21 void test() {
22 lam_correct<1>();
23 lam_correct<2>();
24
25 lam_incorrect<1>();
26 lam_incorrect<2>();
27 }
28
29 }