public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109307] New: [13 Regression] constructors fails typecheck on initializer list assignment
@ 2023-03-27 22:27 slyfox at gcc dot gnu.org
  2023-03-27 22:29 ` [Bug c++/109307] " jakub at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: slyfox at gcc dot gnu.org @ 2023-03-27 22:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109307
           Summary: [13 Regression] constructors fails typecheck on
                    initializer list assignment
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Seems to be this week's regression. On gcc-13 webkitgtk-2.38.5 fails to uild
as:

/home/slyfox/n/webkitgtk-2.38.5/Source/WebCore/platform/graphics/SourceBrush.cpp:68:78:
error: converting to 'std::optional<WebCore::SourceBrush::Brush>' from
initializer list would use explicit constructor 'constexpr
std::optional<_Tp>::optional(_Up&&) [with _Up =
WebCore::SourceBrush::Brush::LogicalGradient; typename
std::enable_if<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename
std::remove_cv<typename std::remove_reference<_Iter>::type>::type> >,
std::__not_<std::is_same<std::in_place_t, typename std::remove_cv<typename
std::remove_reference<_Iter>::type>::type> >, std::is_constructible<_Tp, _Up>,
std::__not_<std::is_convertible<_Iter, _Iterator> > >, bool>::type <anonymous>
= false; _Tp = WebCore::SourceBrush::Brush]'
   68 |     m_brush = { Brush::LogicalGradient { WTFMove(gradient),
spaceTransform } };
      |                                                                        
     ^

gcc-12 is fine. I think this is the cmall example that illustrates the failure:

// $ cat SourceBrush.cpp
#include <optional>
#include <variant>

class RefGradient {};
class RefPattern {};
class AffineTransform {};

class SourceBrush {
  public:
    struct Brush {
        struct LogicalGradient {
            RefGradient gradient;
            AffineTransform spaceTransform;
        };

        std::variant<LogicalGradient, RefPattern> brush;
    };

    void setGradient(RefGradient &&, const AffineTransform & spaceTransform = {
});
    void setPattern(RefPattern &&);

  private:
    std::optional<Brush> m_brush;
};

void SourceBrush::setGradient(RefGradient&& gradient, const AffineTransform&
spaceTransform)
{
    m_brush = { Brush::LogicalGradient { std::move(gradient), spaceTransform }
};
}

void SourceBrush::setPattern(RefPattern&& pattern)
{
    m_brush = { std::move(pattern) };
}


gcc-12 works:

$ g++-12.2.0 SourceBrush.cpp -c -std=c++20
<ok>

$ g++-13.0.0 SourceBrush.cpp -c -std=c++20
SourceBrush.cpp: In member function 'void
SourceBrush::setGradient(RefGradient&&, const AffineTransform&)':
SourceBrush.cpp:28:80: error: converting to 'std::optional<SourceBrush::Brush>'
from initializer list would use explicit constructor 'constexpr
std::optional<_Tp>::optional(_Up&&) [with _Up =
SourceBrush::Brush::LogicalGradient; typename
std::enable_if<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename
std::remove_cv<typename std::remove_reference<_Iter>::type>::type> >,
std::__not_<std::is_same<std::in_place_t, typename std::remove_cv<typename
std::remove_reference<_Iter>::type>::type> >, std::is_constructible<_Tp, _Up>,
std::__not_<std::is_convertible<_Up, _Tp> > >, bool>::type <anonymous> = false;
_Tp = SourceBrush::Brush]'
   28 |     m_brush = { Brush::LogicalGradient { std::move(gradient),
spaceTransform } };
      |                                                                        
       ^
SourceBrush.cpp: In member function 'void
SourceBrush::setPattern(RefPattern&&)':
SourceBrush.cpp:33:36: error: converting to 'std::optional<SourceBrush::Brush>'
from initializer list would use explicit constructor 'constexpr
std::optional<_Tp>::optional(_Up&&) [with _Up = RefPattern; typename
std::enable_if<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename
std::remove_cv<typename std::remove_reference<_Iter>::type>::type> >,
std::__not_<std::is_same<std::in_place_t, typename std::remove_cv<typename
std::remove_reference<_Iter>::type>::type> >, std::is_constructible<_Tp, _Up>,
std::__not_<std::is_convertible<_Up, _Tp> > >, bool>::type <anonymous> = false;
_Tp = SourceBrush::Brush]'
   33 |     m_brush = { std::move(pattern) };
      |                                    ^

$ g++-13.0.0 -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-13.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-13.0.0/libexec/gcc/x86_64-unknown-linux-gnu/13.0.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230326 (experimental) (GCC)

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

* [Bug c++/109307] [13 Regression] constructors fails typecheck on initializer list assignment
  2023-03-27 22:27 [Bug c++/109307] New: [13 Regression] constructors fails typecheck on initializer list assignment slyfox at gcc dot gnu.org
@ 2023-03-27 22:29 ` jakub at gcc dot gnu.org
  0 siblings, 0 replies; 2+ 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=109307

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Dup.

*** This bug has been marked as a duplicate of bug 109247 ***

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

end of thread, other threads:[~2023-03-27 22:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-27 22:27 [Bug c++/109307] New: [13 Regression] constructors fails typecheck on initializer list assignment slyfox at gcc dot gnu.org
2023-03-27 22:29 ` [Bug c++/109307] " jakub 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).