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}; }
      |                                                    ^

Reply via email to