Bug 2151525 - Discrepancies between GCC Toolset 11 and MSVC on C++ braced initializer list
Summary: Discrepancies between GCC Toolset 11 and MSVC on C++ braced initializer list
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: gcc-toolset-11
Version: 8.6
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Marek Polacek
QA Contact: qe-baseos-tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-12-07 13:08 UTC by Paulo Andrade
Modified: 2023-07-18 14:19 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-12-21 21:49:26 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
C11Test.cpp (920 bytes, text/plain)
2022-12-07 13:08 UTC, Paulo Andrade
no flags Details


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 83264 0 P3 UNCONFIRMED std::initializer_list with a single element selects the wrong overload 2022-12-21 21:49:25 UTC
Red Hat Issue Tracker RHELPLAN-141531 0 None None None 2022-12-07 13:19:29 UTC

Description Paulo Andrade 2022-12-07 13:08:04 UTC
Created attachment 1930808 [details]
C11Test.cpp

It appears not only MSVC, but also clang and intel compiler does differently.

  In the sample reproducer, to have the same output of other compilers needs
commenting out

    Test(std::initializer_list<Test> init)

  The issue is not specific to gcc-toolset-11. Apparently gcc understands the
braced initializer as a verbatim vector initializer list:
https://en.cppreference.com/w/cpp/utility/initializer_list

Comment 2 Marek Polacek 2022-12-21 21:49:26 UTC
This is a known problem.  There's been some movement in the upstream PR:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83264#c11

so maybe this will get resolved relatively soon.  But it needs to be fixed in the upstream first.


Note You need to log in before you can comment on or make changes to this bug.