https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108077
Bug ID: 108077 Summary: [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: romain.geissler at amadeus dot com Target Milestone: --- Hi, I can't build llvm 15 with the current gcc 13, while it was working a few weeks ago. I tried to reduce a bit, and I have ended up with this snippet (compiled with -std=gnu++17): <<END_OF_FILE #include <list> class OptSpecifier { unsigned ID = 0; public: explicit OptSpecifier(bool) = delete; // Works if this is commented OptSpecifier(unsigned ID) : ID(ID) {} }; //void f(llvm::ArrayRef<llvm::opt::OptSpecifier>) {} void f(std::list<OptSpecifier>) {} int main() { f({1U, 2U, 3U}); // Works f({1, 2, 3}); // Fails with gcc 13 } END_OF_FILE According to Compiler Explorer, this seems to build fine with any clang version, and any gcc <= 12, but not with current gcc 13 trunk. The error is the following: In file included from /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/x86_64-linux-gnu/bits/c++allocator.h:33, from /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/allocator.h:46, from /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/list:63, from <source>:1: /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/new_allocator.h: In instantiation of 'void std::__new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = OptSpecifier; _Args = {const int&}; _Tp = std::_List_node<OptSpecifier>]': /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/alloc_traits.h:524:17: required from 'static void std::allocator_traits<std::allocator<_Tp1> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = OptSpecifier; _Args = {const int&}; _Tp = std::_List_node<OptSpecifier>; allocator_type = std::allocator<std::_List_node<OptSpecifier> >]' /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/stl_list.h:713:33: required from 'std::__cxx11::list<_Tp, _Alloc>::_Node* std::__cxx11::list<_Tp, _Alloc>::_M_create_node(_Args&& ...) [with _Args = {const int&}; _Tp = OptSpecifier; _Alloc = std::allocator<OptSpecifier>; _Node = std::__cxx11::list<OptSpecifier>::_Node]' /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/stl_list.h:2005:32: required from 'void std::__cxx11::list<_Tp, _Alloc>::_M_insert(iterator, _Args&& ...) [with _Args = {const int&}; _Tp = OptSpecifier; _Alloc = std::allocator<OptSpecifier>; iterator = std::__cxx11::list<OptSpecifier>::iterator]' /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/stl_list.h:1321:19: required from 'std::__cxx11::list<_Tp, _Alloc>::reference std::__cxx11::list<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {const int&}; _Tp = OptSpecifier; _Alloc = std::allocator<OptSpecifier>; reference = OptSpecifier&]' /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/stl_list.h:1934:18: required from 'void std::__cxx11::list<_Tp, _Alloc>::_M_initialize_dispatch(_InputIterator, _InputIterator, std::__false_type) [with _InputIterator = const int*; _Tp = OptSpecifier; _Alloc = std::allocator<OptSpecifier>]' /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/stl_list.h:882:26: required from 'std::__cxx11::list<_Tp, _Alloc>::list(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = const int*; <template-parameter-2-2> = void; _Tp = OptSpecifier; _Alloc = std::allocator<OptSpecifier>; allocator_type = std::allocator<OptSpecifier>]' <source>:17:6: required from here /opt/compiler-explorer/gcc-trunk-20221212/include/c++/13.0.0/bits/new_allocator.h:187:11: error: call of overloaded 'OptSpecifier(const int&)' is ambiguous 187 | { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <source>:8:3: note: candidate: 'OptSpecifier::OptSpecifier(unsigned int)' 8 | OptSpecifier(unsigned ID) : ID(ID) {} | ^~~~~~~~~~~~ <source>:7:12: note: candidate: 'OptSpecifier::OptSpecifier(bool)' (deleted) 7 | explicit OptSpecifier(bool) = delete; // Works if this is commented | ^~~~~~~~~~~~ <source>:3:7: note: candidate: 'constexpr OptSpecifier::OptSpecifier(const OptSpecifier&)' 3 | class OptSpecifier { | ^~~~~~~~~~~~ <source>:3:7: note: candidate: 'constexpr OptSpecifier::OptSpecifier(OptSpecifier&&)' Compiler returned: 1