Bug 2151525

Summary: Discrepancies between GCC Toolset 11 and MSVC on C++ braced initializer list
Product: Red Hat Enterprise Linux 8 Reporter: Paulo Andrade <pandrade>
Component: gcc-toolset-11Assignee: Marek Polacek <mpolacek>
Status: CLOSED UPSTREAM QA Contact: qe-baseos-tools-bugs
Severity: medium Docs Contact:
Priority: medium    
Version: 8.6CC: sipoyare
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-21 21:49:26 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
C11Test.cpp none

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.