Skip to content

Commit 15aaef0

Browse files
committed
Use declaresSameEntity, added release notes.
1 parent cc00e6a commit 15aaef0

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
@@ -689,6 +689,7 @@ Bug Fixes in This Version
689689
- Fixed type mismatch error when 'builtin-elementwise-math' arguments have different qualifiers, this should be well-formed. (#GH141397)
690690
- Constant evaluation now correctly runs the destructor of a variable declared in
691691
the second clause of a C-style ``for`` loop. (#GH139818)
692+
- Fixed a bug with constexpr evaluation for structs containing unions in case of C++ modules. (#GH143168)
692693

693694
Bug Fixes to Compiler Builtins
694695
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

clang/lib/AST/ExprConstant.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6836,15 +6836,16 @@ static bool HandleConstructorCall(const Expr *E, const LValue &This,
68366836
// and make sure we've initialized every step along it.
68376837
auto IndirectFieldChain = IFD->chain();
68386838
for (auto *C : IndirectFieldChain) {
6839-
FD = cast<FieldDecl>(C)->getCanonicalDecl();
6839+
FD = cast<FieldDecl>(C);
68406840
CXXRecordDecl *CD = cast<CXXRecordDecl>(FD->getParent());
68416841
// Switch the union field if it differs. This happens if we had
68426842
// preceding zero-initialization, and we're now initializing a union
68436843
// subobject other than the first.
68446844
// FIXME: In this case, the values of the other subobjects are
68456845
// specified, since zero-initialization sets all padding bits to zero.
68466846
if (!Value->hasValue() ||
6847-
(Value->isUnion() && Value->getUnionField() != FD)) {
6847+
(Value->isUnion() &&
6848+
!declaresSameEntity(Value->getUnionField(), FD))) {
68486849
if (CD->isUnion())
68496850
*Value = APValue(FD);
68506851
else

0 commit comments

Comments
 (0)