[all-commits] [llvm/llvm-project] d05106: [Clang] Re-analyze parenthesized aggregate mem-ini...
Akash Manna via All-commits
all-commits at lists.llvm.org
Thu Sep 24 13:49:07 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: d051060325e27aba3536419925f985321e441db9
https://github.com/llvm/llvm-project/commit/d051060325e27aba3536419925f985321e441db9
Author: Akash Manna <akash.manna.mymail at gmail.com>
Date: 2026-09-24 (Thu, 24 Sep 2026)
Changed paths:
M clang/docs/ReleaseNotes.md
M clang/lib/Sema/SemaDeclCXX.cpp
A clang/test/CodeGenCXX/GH176161.cpp
M clang/test/SemaCXX/paren-list-agg-init.cpp
Log Message:
-----------
[Clang] Re-analyze parenthesized aggregate mem-initializers on instantiation (#224918)
Fixes #176161
Fixes #189005
Fixes #213284
Since #138518, template instantiation keeps a parenthesized aggregate
initialization as a `CXXParenListInitExpr`, but its elements have
already been reverted to their written form (a braced list stays a
braced list, an implicit cast is stripped), so whoever consumes the node
has to redo the initialization from them. Variable initializers,
new-expressions and functional casts do that. `BuildMemberInitializer`
didn't: it took the whole node as one argument, guaranteed elision
accepted it as-is, and the constructor ended up with a member
initializer that was never analyzed. Depending on the shape that's the
`EmitAggExpr` assertion (#176161, #189005), a `0` stored as 32 bits into
a 64-bit field (#213284), a rejected valid array member like `arr(1,
2)`, or a union member silently left uninitialized. Clang 20 handled all
of these. The lambda and local class in #176161 are incidental; a plain
class template reproduces it.
`BuildMemberInitializer` now treats a `CXXParenListInitExpr` the way it
treats a `ParenListExpr` and performs the initialization from the
user-specified elements. Using only those elements (not the trailing
default-member-initializer and value-initialization ones Sema appends)
means they get rebuilt for the instantiated class rather than fed back
in as arguments. This mirrors what #141342 did for variable initializers
and #142988 for new-expressions, and supersedes #213565.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list