public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109523] New: List-initializing constructor of std::vector is selected erroneously
@ 2023-04-15 9:07 fchelnokov at gmail dot com
2023-04-15 9:31 ` [Bug c++/109523] " pinskia at gcc dot gnu.org
2023-04-15 9:35 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: fchelnokov at gmail dot com @ 2023-04-15 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109523
Bug ID: 109523
Summary: List-initializing constructor of std::vector is
selected erroneously
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
The following program
#include <vector>
struct C {
int a;
constexpr C() : a(0) {}
constexpr C(int a) : a(a) {}
};
static_assert( std::vector<C>({5}).size() == 5 );
is accepted in Clang and MSVC. But in GCC static assertion fails, because it
constructs a vector of single element 5. Online demo:
https://gcc.godbolt.org/z/j4b3z5xxP
Related discussion with explanation:
https://stackoverflow.com/q/76013629/7325599
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/109523] List-initializing constructor of std::vector is selected erroneously
2023-04-15 9:07 [Bug c++/109523] New: List-initializing constructor of std::vector is selected erroneously fchelnokov at gmail dot com
@ 2023-04-15 9:31 ` pinskia at gcc dot gnu.org
2023-04-15 9:35 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 9:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109523
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Nope, GCC is actually the only compiler that implements this correctly in this
case.
Duplicate of bug 85577.
https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2137
*** This bug has been marked as a duplicate of bug 85577 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/109523] List-initializing constructor of std::vector is selected erroneously
2023-04-15 9:07 [Bug c++/109523] New: List-initializing constructor of std::vector is selected erroneously fchelnokov at gmail dot com
2023-04-15 9:31 ` [Bug c++/109523] " pinskia at gcc dot gnu.org
@ 2023-04-15 9:35 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-15 9:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109523
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Actually it is a dup of bug 83264.
*** This bug has been marked as a duplicate of bug 83264 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-04-15 9:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-15 9:07 [Bug c++/109523] New: List-initializing constructor of std::vector is selected erroneously fchelnokov at gmail dot com
2023-04-15 9:31 ` [Bug c++/109523] " pinskia at gcc dot gnu.org
2023-04-15 9:35 ` pinskia 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).