public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102050] New: Nonempty list-initialization rejects constructor with defaulted std::initializer_list
@ 2021-08-24 21:26 johelegp at gmail dot com
2021-09-14 18:41 ` [Bug c++/102050] " ppalka at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: johelegp at gmail dot com @ 2021-08-24 21:26 UTC (permalink / raw)
To: gcc-bugs
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/102050] Nonempty list-initialization rejects constructor with defaulted std::initializer_list
2021-08-24 21:26 [Bug c++/102050] New: Nonempty list-initialization rejects constructor with defaulted std::initializer_list johelegp at gmail dot com
@ 2021-09-14 18:41 ` ppalka at gcc dot gnu.org
2021-09-15 17:56 ` cvs-commit at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-09-14 18:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102050
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Target Milestone|--- |12.0
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
CC| |ppalka at gcc dot gnu.org
Last reconfirmed| |2021-09-14
Ever confirmed|0 |1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/102050] Nonempty list-initialization rejects constructor with defaulted std::initializer_list
2021-08-24 21:26 [Bug c++/102050] New: Nonempty list-initialization rejects constructor with defaulted std::initializer_list johelegp at gmail dot com
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
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-09-15 17:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102050
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:2ab5c3d5457f0d480c6423ee7ac52ce1f98592c9
commit r12-3555-g2ab5c3d5457f0d480c6423ee7ac52ce1f98592c9
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Sep 15 13:54:53 2021 -0400
c++: default ctor that's also a list ctor [PR102050]
In grok_special_member_properties we need to set TYPE_HAS_COPY_CTOR,
TYPE_HAS_DEFAULT_CONSTRUCTOR and TYPE_HAS_LIST_CTOR independently
from each other because a constructor can be both a default and list
constructor (as in the first testcase), or both a default and copy
constructor (as in the second testcase).
PR c++/102050
gcc/cp/ChangeLog:
* decl.c (grok_special_member_properties): Set
TYPE_HAS_COPY_CTOR, TYPE_HAS_DEFAULT_CONSTRUCTOR
and TYPE_HAS_LIST_CTOR independently from each other.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/initlist125.C: New test.
* g++.dg/cpp0x/initlist126.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/102050] Nonempty list-initialization rejects constructor with defaulted std::initializer_list
2021-08-24 21:26 [Bug c++/102050] New: Nonempty list-initialization rejects constructor with defaulted std::initializer_list johelegp at gmail dot com
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
3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-09-15 18:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102050
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/102050] Nonempty list-initialization rejects constructor with defaulted std::initializer_list
2021-08-24 21:26 [Bug c++/102050] New: Nonempty list-initialization rejects constructor with defaulted std::initializer_list johelegp at gmail dot com
` (2 preceding siblings ...)
2021-09-15 18:02 ` ppalka at gcc dot gnu.org
@ 2021-12-22 13:17 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-12-22 13:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102050
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppluzhnikov at google dot com
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 60437 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-12-22 13:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-24 21:26 [Bug c++/102050] New: Nonempty list-initialization rejects constructor with defaulted std::initializer_list johelegp at gmail dot com
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
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).