[all-commits] [llvm/llvm-project] c77a91: [clang] Remove overly restrictive aggregate paren ...
Alan Zhao via All-commits
all-commits at lists.llvm.org
Wed Dec 21 08:21:18 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: c77a91bb7ba793ec3a6a5da3743ed55056291658
https://github.com/llvm/llvm-project/commit/c77a91bb7ba793ec3a6a5da3743ed55056291658
Author: Alan Zhao <ayzhao at google.com>
Date: 2022-12-21 (Wed, 21 Dec 2022)
Changed paths:
M clang/lib/Sema/SemaInit.cpp
M clang/test/CodeGen/paren-list-agg-init.cpp
Log Message:
-----------
[clang] Remove overly restrictive aggregate paren init logic
Previously, we would only attempt to perform a parenthesized aggregate
initialization if constructor initialization failed for only the default
constructor, default copy constructor, and default move constructor. The
original intent of this logic was to reject initializing objects that
have failed resolving a user-defined constructor. However, this check is
redundant because we check for isAggregate() before attempting to
perform a parenthesized aggregate initialization, and classes that have
user-defined or user-declared constructors are not aggregates.
Furthermore, this check is too restrictive - the following valid
examples fail:
* Aggregate class with user-defined destructor - fails because default
move constructors are not generated for classes with user-defined
destructors
(https://github.com/llvm/llvm-project/issues/54040#issuecomment-1356926048)
* Concept-guarded conversion operator on an aggregate's member:
(https://github.com/llvm/llvm-project/issues/54040#issuecomment-1356931745)
The solution therefore is to remove this logic; existing tests still
pass, and the previously failing examples now compile.
Reviewed By: ilya-biryukov
Differential Revision: https://reviews.llvm.org/D140327
More information about the All-commits
mailing list