Skip to content

Commit 8b50816

Browse files
committed
Address review comments
1 parent 695dff6 commit 8b50816

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ C++20 Feature Support
7676

7777
C++23 Feature Support
7878
^^^^^^^^^^^^^^^^^^^^^
79+
- Removed the restriction to literal types in constexpr functions in C++23 mode.
7980

8081
C++2c Feature Support
8182
^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ExprConstant.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,10 +2401,11 @@ static bool CheckMemberPointerConstantExpression(EvalInfo &Info,
24012401
/// produce an appropriate diagnostic.
24022402
static bool CheckLiteralType(EvalInfo &Info, const Expr *E,
24032403
const LValue *This = nullptr) {
2404-
if (!E->isPRValue() || E->getType()->isLiteralType(Info.Ctx))
2404+
// The restriction to literal types does not exist in C++23 anymore.
2405+
if (Info.getLangOpts().CPlusPlus23)
24052406
return true;
24062407

2407-
if (Info.getLangOpts().CPlusPlus23)
2408+
if (!E->isPRValue() || E->getType()->isLiteralType(Info.Ctx))
24082409
return true;
24092410

24102411
// C++1y: A constant initializer for an object o [...] may also invoke

0 commit comments

Comments
 (0)