public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "johelegp at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/102050] New: Nonempty list-initialization rejects constructor with defaulted std::initializer_list Date: Tue, 24 Aug 2021 21:26:05 +0000 [thread overview] Message-ID: <bug-102050-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102050 Bug ID: 102050 Summary: Nonempty list-initialization rejects constructor with defaulted std::initializer_list Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: johelegp at gmail dot com CC: johelegp at gmail dot com Target Milestone: --- See https://godbolt.org/z/5PGza1o8e. ```C++ #include <initializer_list> struct S { S( std::initializer_list<int> = {} ) {} }; int main() { S{0}; } ``` ``` <source>: In function 'int main()': <source>:3:17: error: no matching function for call to 'S::S(<brace-enclosed initializer list>)' 3 | int main() { S{0}; } | ^ <source>:2:12: note: candidate: 'S::S(std::initializer_list<int>)' 2 | struct S { S( std::initializer_list<int> = {} ) {} }; | ^ <source>:2:15: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' 2 | struct S { S( std::initializer_list<int> = {} ) {} }; | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:2:8: note: candidate: 'constexpr S::S(const S&)' 2 | struct S { S( std::initializer_list<int> = {} ) {} }; | ^ <source>:2:8: note: no known conversion for argument 1 from 'int' to 'const S&' <source>:2:8: note: candidate: 'constexpr S::S(S&&)' <source>:2:8: note: no known conversion for argument 1 from 'int' to 'S&&' Compiler returned: 1 ``` This came up at https://cpplang.slack.com/archives/C2SLQATS9/p1629835850325200.
next reply other threads:[~2021-08-24 21:26 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-24 21:26 johelegp at gmail dot com [this message] 2021-09-14 18:41 ` [Bug c++/102050] " ppalka at gcc dot gnu.org 2021-09-15 17:56 ` cvs-commit at gcc dot gnu.org 2021-09-15 18:02 ` ppalka at gcc dot gnu.org 2021-12-22 13:17 ` ppalka at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-102050-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).