[clang] [clang] Avoid doing C++20 aggregate init during copy-initialization (PR #131320)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 14 07:00:24 PDT 2025
================
@@ -6714,7 +6714,8 @@ void InitializationSequence::InitializeFrom(Sema &S,
OverloadCandidateSet::iterator Best;
OverloadingResult OR = getFailedCandidateSet().BestViableFunction(
S, Kind.getLocation(), Best);
- if (OR != OverloadingResult::OR_Deleted) {
+ if (OR != OverloadingResult::OR_Deleted &&
+ Kind.getKind() == InitializationKind::IK_Direct) {
----------------
offsetof wrote:
This is https://eel.is/c++draft/dcl.init.general#16.6.2.2.sentence-1, specifically "and the initializer is a parenthesized *expression-list*". The bug is that `X x = y;` is treated as `X x(y);` when `y` has type <code>*cv* X</code> and `X` has no viable constructor for the initialization.
The linked core issue is indeed related to arrays (handled by a different bullet) and is not relevant here.
https://github.com/llvm/llvm-project/pull/131320
More information about the cfe-commits
mailing list