public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108077] New: [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier
@ 2022-12-12 18:39 romain.geissler at amadeus dot com
  2022-12-12 18:42 ` [Bug c++/108077] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: romain.geissler at amadeus dot com @ 2022-12-12 18:39 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/108077] [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier
  2022-12-12 18:39 [Bug c++/108077] New: [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier romain.geissler at amadeus dot com
@ 2022-12-12 18:42 ` pinskia at gcc dot gnu.org
  2022-12-12 19:14 ` redi at gcc dot gnu.org
  2022-12-13  8:49 ` romain.geissler at amadeus dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-12 18:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108077

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=108071,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=108047
   Target Milestone|---                         |13.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/108077] [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier
  2022-12-12 18:39 [Bug c++/108077] New: [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier romain.geissler at amadeus dot com
  2022-12-12 18:42 ` [Bug c++/108077] " pinskia at gcc dot gnu.org
@ 2022-12-12 19:14 ` redi at gcc dot gnu.org
  2022-12-13  8:49 ` romain.geissler at amadeus dot com
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2022-12-12 19:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108077

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This is Bug 108071 comment 7.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/108077] [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier
  2022-12-12 18:39 [Bug c++/108077] New: [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier romain.geissler at amadeus dot com
  2022-12-12 18:42 ` [Bug c++/108077] " pinskia at gcc dot gnu.org
  2022-12-12 19:14 ` redi at gcc dot gnu.org
@ 2022-12-13  8:49 ` romain.geissler at amadeus dot com
  2 siblings, 0 replies; 4+ messages in thread
From: romain.geissler at amadeus dot com @ 2022-12-13  8:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108077

Romain Geissler <romain.geissler at amadeus dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Romain Geissler <romain.geissler at amadeus dot com> ---
Indeed this is working now after Jason reverted his commit as mentioned in Bug
108071.

I close this ticket.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-13  8:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 18:39 [Bug c++/108077] New: [13 Regression] Can't brace initialize container of llvm::opt::OptSpecifier romain.geissler at amadeus dot com
2022-12-12 18:42 ` [Bug c++/108077] " pinskia at gcc dot gnu.org
2022-12-12 19:14 ` redi at gcc dot gnu.org
2022-12-13  8:49 ` romain.geissler at amadeus dot com

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).