public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6
@ 2023-03-22 12:16 marxin at gcc dot gnu.org
  2023-03-22 12:16 ` [Bug c++/109247] " marxin at gcc dot gnu.org
                   ` (21 more replies)
  0 siblings, 22 replies; 23+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-03-22 12:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109247
           Summary: [13 Regression] error: converting to
                    ‘optional<WebCore::SourceBrush::Brush>’ from
                    initializer list would use explicit constructor
                    ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp =
                    WebCore::SourceBrush::Brush]’ since
                    r13-6765-ga226590fefb35ed6
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: mpolacek at gcc dot gnu.org
  Target Milestone: ---

The following is reduced from webkit2gtk3:gtk3 package:

$ cat webcore13.ii
template <typename _Tp> struct optional {
  template <typename _Up> explicit optional(_Up);
  template <typename _Up = _Tp> void operator=(_Up);
};
namespace WebCore {
int setPattern_pattern;
struct SourceBrush {
  struct Brush {
    int brush;
  };
  void setPattern() { m_brush = {setPattern_pattern}; }
  optional<Brush> m_brush;
};
} // namespace WebCore

$ clang++ webcore13.ii -c && g++-12 webcore13.ii -c
$ g++ webcore13.ii -c
webcore13.ii: In member function ‘void WebCore::SourceBrush::setPattern()’:
webcore13.ii:11:52: error: converting to
‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use
explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp =
WebCore::SourceBrush::Brush]’
   11 |   void setPattern() { m_brush = {setPattern_pattern}; }
      |                                                    ^

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

* [Bug c++/109247] [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
@ 2023-03-22 12:16 ` marxin at gcc dot gnu.org
  2023-03-23  9:41 ` [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor " jakub at gcc dot gnu.org
                   ` (20 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-03-22 12:16 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1
   Target Milestone|---                         |13.0
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-03-22

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
  2023-03-22 12:16 ` [Bug c++/109247] " marxin at gcc dot gnu.org
@ 2023-03-23  9:41 ` jakub at gcc dot gnu.org
  2023-03-23 12:12 ` jason at gcc dot gnu.org
                   ` (19 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-23  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly more reduced:
template <typename T>
struct optional {
  template <typename U> explicit optional (U);
  template <typename U = T> void operator= (U);
};
struct T { int a; };
struct S
{
  void foo (int y) { x = { y }; }
  optional<T> x;
};

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
  2023-03-22 12:16 ` [Bug c++/109247] " marxin at gcc dot gnu.org
  2023-03-23  9:41 ` [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor " jakub at gcc dot gnu.org
@ 2023-03-23 12:12 ` jason at gcc dot gnu.org
  2023-03-23 13:20 ` jason at gcc dot gnu.org
                   ` (18 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-23 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-03-23 12:12 ` jason at gcc dot gnu.org
@ 2023-03-23 13:20 ` jason at gcc dot gnu.org
  2023-03-23 13:30 ` ppalka at gcc dot gnu.org
                   ` (17 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-23 13:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> ---
No templates (so it's ambiguous, but the problem is the same):

struct B { int a; };
struct C {
  explicit C (int);
  C& operator= (B);
  C& operator= (const C&);
};
void f(C x)
{
  x = { 42 };
}

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-03-23 13:20 ` jason at gcc dot gnu.org
@ 2023-03-23 13:30 ` ppalka at gcc dot gnu.org
  2023-03-23 14:04 ` ppalka at gcc dot gnu.org
                   ` (16 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-23 13:30 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=84849

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
PR84849 seems related, especially the comment #5 testcase from ensadc:

template<class>
struct in_place_type_t { explicit in_place_type_t() = default; };

struct A { };

int f(A);
int f(in_place_type_t<A>);

int x = f({});

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-03-23 13:30 ` ppalka at gcc dot gnu.org
@ 2023-03-23 14:04 ` ppalka at gcc dot gnu.org
  2023-03-23 18:42 ` jason at gcc dot gnu.org
                   ` (15 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-23 14:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #3)
> PR84849 seems related, especially the comment #5 testcase from ensadc:
> 
> template<class>
> struct in_place_type_t { explicit in_place_type_t() = default; };
> 
> struct A { };
> 
> int f(A);
> int f(in_place_type_t<A>);
> 
> int x = f({});

Oops, this testcase from PR84849 might be strictly speaking invalid and GCC
correct to reject as per
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102247#c2.  Is this PR not invalid
for the same reason?

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-03-23 14:04 ` ppalka at gcc dot gnu.org
@ 2023-03-23 18:42 ` jason at gcc dot gnu.org
  2023-03-23 18:55 ` jason at gcc dot gnu.org
                   ` (14 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-23 18:42 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=60027

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #4)
> Oops, this testcase from PR84849 might be strictly speaking invalid and GCC
> correct to reject.  Is this PR not invalid for the same reason?

Indeed, this seems to be a template form of CWG1228, and thus ill-formed.  But
it was accepted by GCC 9-12 and is also accepted by MSVC, EDG, and Clang, so I
wonder if the committee wants to adjust the standard to match the
implementations; I've asked.

But webkit should probably fix their code anyway, perhaps by changing 

 m_brush = {setPattern_pattern};

to

 m_brush = Brush{setPattern_pattern};

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2023-03-23 18:42 ` jason at gcc dot gnu.org
@ 2023-03-23 18:55 ` jason at gcc dot gnu.org
  2023-03-23 20:03 ` jason at gcc dot gnu.org
                   ` (13 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-23 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |SUSPENDED
           Priority|P1                          |P3

--- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> ---
Suspending for now.

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2023-03-23 18:55 ` jason at gcc dot gnu.org
@ 2023-03-23 20:03 ` jason at gcc dot gnu.org
  2023-03-24  9:13 ` marxin at gcc dot gnu.org
                   ` (12 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-23 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 54739
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54739&action=edit
possible patch

An implementation of my guess at the clang rule, if we end up wanting to go
that way.

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2023-03-23 20:03 ` jason at gcc dot gnu.org
@ 2023-03-24  9:13 ` marxin at gcc dot gnu.org
  2023-03-27 22:29 ` jakub at gcc dot gnu.org
                   ` (11 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-03-24  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://github.com/WebKit/W
                   |                            |ebKit/pull/11910

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
> But webkit should probably fix their code anyway, perhaps by changing 
> 
>  m_brush = {setPattern_pattern};
> 
> to
> 
>  m_brush = Brush{setPattern_pattern};

Thank you Jason for the analysis, I've just suggested the change to upstream
project:
https://github.com/WebKit/WebKit/pull/11910

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

* [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2023-03-24  9:13 ` marxin at gcc dot gnu.org
@ 2023-03-27 22:29 ` jakub at gcc dot gnu.org
  2023-04-26  6:58 ` [Bug c++/109247] [13/14 " rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-03-27 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |slyfox at gcc dot gnu.org

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 109307 has been marked as a duplicate of this bug. ***

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2023-03-27 22:29 ` jakub at gcc dot gnu.org
@ 2023-04-26  6:58 ` rguenth at gcc dot gnu.org
  2023-04-28 14:57 ` pinskia at gcc dot gnu.org
                   ` (9 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-04-26  6:58 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.0                        |13.2

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.1 is being released, retargeting bugs to GCC 13.2.

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2023-04-26  6:58 ` [Bug c++/109247] [13/14 " rguenth at gcc dot gnu.org
@ 2023-04-28 14:57 ` pinskia at gcc dot gnu.org
  2023-04-28 15:41 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-04-28 14:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |carlosgalvezp at gmail dot com

--- Comment #11 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 109663 has been marked as a duplicate of this bug. ***

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2023-04-28 14:57 ` pinskia at gcc dot gnu.org
@ 2023-04-28 15:41 ` mpolacek at gcc dot gnu.org
  2023-05-17 10:19 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-04-28 15:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I suppose we should add a porting_to.html note about this (in light of Bug
109663).

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2023-04-28 15:41 ` mpolacek at gcc dot gnu.org
@ 2023-05-17 10:19 ` redi at gcc dot gnu.org
  2023-05-22 22:52 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: redi at gcc dot gnu.org @ 2023-05-17 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vincent.lebourlot@starqube.
                   |                            |com

--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
*** Bug 109888 has been marked as a duplicate of this bug. ***

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2023-05-17 10:19 ` redi at gcc dot gnu.org
@ 2023-05-22 22:52 ` pinskia at gcc dot gnu.org
  2023-05-31 19:35 ` jason at gcc dot gnu.org
                   ` (5 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-22 22:52 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |enolan at alumni dot cmu.edu

--- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 109937 has been marked as a duplicate of this bug. ***

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2023-05-22 22:52 ` pinskia at gcc dot gnu.org
@ 2023-05-31 19:35 ` jason at gcc dot gnu.org
  2023-05-31 21:02 ` jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu.org @ 2023-05-31 19:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #54739|0                           |1
        is obsolete|                            |

--- Comment #15 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 55226
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55226&action=edit
more targeted patch

Discussion in CWG led to this more specific rule that only affects the
copy/move special member functions, and so doesn't affect the 84849 testcases:

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2023-05-31 19:35 ` jason at gcc dot gnu.org
@ 2023-05-31 21:02 ` jason at gcc dot gnu.org
  2023-06-02 15:54 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: jason at gcc dot gnu.org @ 2023-05-31 21:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #15)
> Discussion in CWG led to this more specific rule that only affects the
> copy/move special member functions, and so doesn't affect the 84849
> testcases:

Correction: it does fix the first three 84849 testcases, which are non-template
forms of the same issue.

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2023-05-31 21:02 ` jason at gcc dot gnu.org
@ 2023-06-02 15:54 ` cvs-commit at gcc dot gnu.org
  2023-06-23 16:43 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-02 15:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:9872d56661ade358c440914361c1ebdccd975bec

commit r14-1502-g9872d56661ade358c440914361c1ebdccd975bec
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 26 12:28:15 2023 -0400

    c++: fix explicit/copy problem [PR109247]

    In the testcase, the user wants the assignment to use the operator=
declared
    in the class, but because [over.match.list] says that explicit constructors
    are also considered for list-initialization, as affirmed in CWG1228, we end
    up choosing the implicitly-declared copy assignment operator, using the
    explicit constructor template for the argument, which is ill-formed.  Other
    implementations haven't implemented CWG1228, so we keep getting bug
reports.

    Discussion in CWG led to the idea for this targeted relaxation: if we use
an
    explicit constructor for the conversion to the argument of a copy or move
    special member function, that makes the candidate worse than another.

            DR 2735
            PR c++/109247

    gcc/cp/ChangeLog:

            * call.cc (sfk_copy_or_move): New.
            (joust): Add tiebreaker for explicit conv and copy ctor.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/initlist-explicit3.C: New test.

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (18 preceding siblings ...)
  2023-06-02 15:54 ` cvs-commit at gcc dot gnu.org
@ 2023-06-23 16:43 ` cvs-commit at gcc dot gnu.org
  2023-07-27  9:25 ` rguenth at gcc dot gnu.org
  2024-03-10  3:34 ` law at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-23 16:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:dc7f1bfbe5999e4639cf3f3afe70043b49352fdf

commit r13-7470-gdc7f1bfbe5999e4639cf3f3afe70043b49352fdf
Author: Jason Merrill <jason@redhat.com>
Date:   Fri May 26 12:28:15 2023 -0400

    c++: fix explicit/copy problem [PR109247]

    In the testcase, the user wants the assignment to use the operator=
declared
    in the class, but because [over.match.list] says that explicit constructors
    are also considered for list-initialization, as affirmed in CWG1228, we end
    up choosing the implicitly-declared copy assignment operator, using the
    explicit constructor template for the argument, which is ill-formed.  Other
    implementations haven't implemented CWG1228, so we keep getting bug
reports.

    Discussion in CWG led to the idea for this targeted relaxation: if we use
an
    explicit constructor for the conversion to the argument of a copy or move
    special member function, that makes the candidate worse than another.

            DR 2735
            PR c++/109247

    gcc/cp/ChangeLog:

            * call.cc (sfk_copy_or_move): New.
            (joust): Add tiebreaker for explicit conv and copy ctor.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/initlist-explicit3.C: New test.

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (19 preceding siblings ...)
  2023-06-23 16:43 ` cvs-commit at gcc dot gnu.org
@ 2023-07-27  9:25 ` rguenth at gcc dot gnu.org
  2024-03-10  3:34 ` law at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-27  9:25 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.2                        |13.3

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 13.2 is being released, retargeting bugs to GCC 13.3.

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

* [Bug c++/109247] [13/14 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor since r13-6765-ga226590fefb35ed6
  2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
                   ` (20 preceding siblings ...)
  2023-07-27  9:25 ` rguenth at gcc dot gnu.org
@ 2024-03-10  3:34 ` law at gcc dot gnu.org
  21 siblings, 0 replies; 23+ messages in thread
From: law at gcc dot gnu.org @ 2024-03-10  3:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jeffrey A. Law <law at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |law at gcc dot gnu.org
             Status|SUSPENDED                   |RESOLVED
         Resolution|---                         |FIXED

--- Comment #20 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Fixed on trunk and backported to gcc-13.

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

end of thread, other threads:[~2024-03-10  3:34 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22 12:16 [Bug c++/109247] New: [13 Regression] error: converting to ‘optional<WebCore::SourceBrush::Brush>’ from initializer list would use explicit constructor ‘optional<_Tp>::optional(_Up) [with _Up = int; _Tp = WebCore::SourceBrush::Brush]’ since r13-6765-ga226590fefb35ed6 marxin at gcc dot gnu.org
2023-03-22 12:16 ` [Bug c++/109247] " marxin at gcc dot gnu.org
2023-03-23  9:41 ` [Bug c++/109247] [13 Regression] optional<T> o; o = {x}; wants to use explicit optional(U) constructor " jakub at gcc dot gnu.org
2023-03-23 12:12 ` jason at gcc dot gnu.org
2023-03-23 13:20 ` jason at gcc dot gnu.org
2023-03-23 13:30 ` ppalka at gcc dot gnu.org
2023-03-23 14:04 ` ppalka at gcc dot gnu.org
2023-03-23 18:42 ` jason at gcc dot gnu.org
2023-03-23 18:55 ` jason at gcc dot gnu.org
2023-03-23 20:03 ` jason at gcc dot gnu.org
2023-03-24  9:13 ` marxin at gcc dot gnu.org
2023-03-27 22:29 ` jakub at gcc dot gnu.org
2023-04-26  6:58 ` [Bug c++/109247] [13/14 " rguenth at gcc dot gnu.org
2023-04-28 14:57 ` pinskia at gcc dot gnu.org
2023-04-28 15:41 ` mpolacek at gcc dot gnu.org
2023-05-17 10:19 ` redi at gcc dot gnu.org
2023-05-22 22:52 ` pinskia at gcc dot gnu.org
2023-05-31 19:35 ` jason at gcc dot gnu.org
2023-05-31 21:02 ` jason at gcc dot gnu.org
2023-06-02 15:54 ` cvs-commit at gcc dot gnu.org
2023-06-23 16:43 ` cvs-commit at gcc dot gnu.org
2023-07-27  9:25 ` rguenth at gcc dot gnu.org
2024-03-10  3:34 ` law 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).