Skip to content

Commit 6044e1b

Browse files
committed
[Clang] fix(93512): skip alignment checks on incomplete types
1 parent e949b54 commit 6044e1b

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,8 @@ Bug Fixes to C++ Support
840840
- Fix a crash caused by improper use of ``__array_extent``. (#GH80474)
841841
- Fixed several bugs in capturing variables within unevaluated contexts. (#GH63845), (#GH67260), (#GH69307),
842842
(#GH88081), (#GH89496), (#GH90669) and (#GH91633).
843+
- Fix an assertion failure caused by parsing a lambda used as a default argument for the value of a
844+
forward-declared class. (#GH93512).
843845

844846
Bug Fixes to AST Handling
845847
^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/Sema/SemaStmt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3355,7 +3355,7 @@ Sema::NamedReturnInfo Sema::getNamedReturnInfo(const VarDecl *VD) {
33553355

33563356
// Variables with higher required alignment than their type's ABI
33573357
// alignment cannot use NRVO.
3358-
if (!VD->hasDependentAlignment() &&
3358+
if (!VD->hasDependentAlignment() && !VDType->isIncompleteType() &&
33593359
Context.getDeclAlign(VD) > Context.getTypeAlignInChars(VDType))
33603360
Info.S = NamedReturnInfo::MoveEligible;
33613361

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2+
3+
struct a; // expected-note {{forward declaration of 'a'}} \
4+
expected-note {{forward declaration of 'a'}}
5+
void b(a c = [] { return c; }); // expected-error {{initialization of incomplete type 'a'}} \
6+
expected-error {{variable has incomplete type 'a'}}

0 commit comments

Comments
 (0)