Skip to content

Commit e9ac9b2

Browse files
author
Jongmyeong Choi
committed
Address review feedback
- Add [[maybe_unused]] to suppress unused variable warning - Add C++98 test case - Fix missing newline
1 parent 44531c6 commit e9ac9b2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6275,8 +6275,8 @@ static ExprResult BuildConvertedConstantExpression(Sema &S, Expr *From,
62756275
QualType T, CCEKind CCE,
62766276
NamedDecl *Dest,
62776277
APValue &PreNarrowingValue) {
6278-
bool isCCEAllowedPreCXX11 =
6279-
(CCE == CCEKind::TempArgStrict || CCE == CCEKind::ExplicitBool);
6278+
[[maybe_unused]] bool isCCEAllowedPreCXX11 =
6279+
(CCE == CCEKind::TempArgStrict || CCE == CCEKind::ExplicitBool);
62806280
assert((S.getLangOpts().CPlusPlus11 || isCCEAllowedPreCXX11) &&
62816281
"converted constant expression outside C++11 or TTP matching");
62826282

clang/test/Parser/explicit-bool-pre-cxx17.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Regression test for assertion failure when explicit(bool) is used in pre-C++20
22
// Fixes GitHub issue #152729
3+
// RUN: %clang_cc1 -std=c++98 -verify %s
34
// RUN: %clang_cc1 -std=c++03 -verify %s
45
// RUN: %clang_cc1 -std=c++11 -verify %s
56
// RUN: %clang_cc1 -std=c++14 -verify %s
@@ -11,4 +12,4 @@ struct S {
1112

1213
explicit(false) S(float);
1314
// expected-warning@-1 {{explicit(bool) is a C++20 extension}}
14-
};
15+
};

0 commit comments

Comments
 (0)