1// RUN: %check_clang_tidy %s google-explicit-constructor %t -std=c++20-or-later
2
3namespace issue_81121
4{
5
6static constexpr bool ConstFalse = false;
7static constexpr bool ConstTrue = true;
8
9struct A {
10 explicit(true) A(int);
11};
12
13struct B {
14 explicit(false) B(int);
15};
16
17struct C {
18 explicit(ConstTrue) C(int);
19};
20
21struct D {
22 explicit(ConstFalse) D(int);
23 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: single-argument constructors explicit expression evaluates to 'false' [google-explicit-constructor]
24};
25
26template <typename>
27struct E {
28 explicit(true) E(int);
29};
30
31template <typename>
32struct F {
33 explicit(false) F(int);
34};
35
36template <typename>
37struct G {
38 explicit(ConstTrue) G(int);
39};
40
41template <typename>
42struct H {
43 explicit(ConstFalse) H(int);
44 // CHECK-MESSAGES: :[[@LINE-1]]:24: warning: single-argument constructors explicit expression evaluates to 'false' [google-explicit-constructor]
45};
46
47template <int Val>
48struct I {
49 explicit(Val > 0) I(int);
50};
51
52template <int Val>
53struct J {
54 explicit(Val > 0) J(int);
55};
56
57void useJ(J<0>, J<100>);
58
59} // namespace issue_81121
60

source code of clang-tools-extra/test/clang-tidy/checkers/google/explicit-constructor-cxx20.cpp