Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang] Don't consider default constructors ineligible if the more co…
…nstrained constructor is a template Partially solves #59206: We now mark trivial constructors as eligible even if there's a more constrained templated default constructor. Although technically non-conformant, this solves problems with pretty reasonable uses cases like ``` template<int n> struct Foo { constexpr Foo() = default; template<class... Ts> Foo(Ts... vals) requires(sizeof...(Ts) == n) {} }; ``` where we currently consider the default constructor to be ineligible and therefor inheriting/containing classes have non trivial constructors. This is aligned with GCC: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c75ebe76ae12ac4020f20a24f34606a594a40d15 This doesn't change `__is_trivial`. Although we're technically standard conformant in this regard, GCC/MSVC exhibit different behaviors that seem to make more sense. An issue has been filed to CWG and we await their response. Reviewed By: erichkeane, #clang-language-wg Differential Revision: https://reviews.llvm.org/D139038
- Loading branch information
1 parent
7fe4abb
commit 7d58c95
Showing
3 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters