Skip to content

Commit b969ec1

Browse files
committed
Added Release Notes and moved comments and minor nits.
1 parent 86029ca commit b969ec1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ Bug Fixes in This Version
589589
- Fixed a crash with an invalid member function parameter list with a default
590590
argument which contains a pragma. (#GH113722)
591591
- Fixed assertion failures when generating name lookup table in modules. (#GH61065, #GH134739)
592+
- Fixed an assertion failure in constant compound literal statements. (#GH139160)
592593

593594
Bug Fixes to Compiler Builtins
594595
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/SemaExpr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7241,16 +7241,16 @@ Sema::BuildCompoundLiteralExpr(SourceLocation LParenLoc, TypeSourceInfo *TInfo,
72417241
? VK_PRValue
72427242
: VK_LValue;
72437243

7244+
// C99 6.5.2.5
7245+
// "If the compound literal occurs outside the body of a function, the
7246+
// initializer list shall consist of constant expressions."
72447247
if (IsFileScope)
72457248
if (auto ILE = dyn_cast<InitListExpr>(LiteralExpr))
72467249
for (unsigned i = 0, j = ILE->getNumInits(); i != j; i++) {
72477250
Expr *Init = ILE->getInit(i);
7248-
// C99 6.5.2.5
7249-
// "If the compound literal occurs outside the body of a function, the
7250-
// initializer list shall consist of constant expressions."
72517251
if (!Init->isTypeDependent() && !Init->isValueDependent() &&
72527252
!Init->getType()->isDependentType())
7253-
if (!Init->isConstantInitializer(Context, false)) {
7253+
if (!Init->isConstantInitializer(Context, /*IsForRef=*/false)) {
72547254
Diag(Init->getExprLoc(), diag::err_init_element_not_constant)
72557255
<< Init->getSourceBitField();
72567256
return ExprError();

0 commit comments

Comments
 (0)