https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108536
Bug ID: 108536 Summary: Difference when using requires and enable_if with class constructor Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: hr.jonas.hansen at gmail dot com Target Milestone: --- In the code below I have used a requires-clause. This requires-clause used to be an enable_if. When using enable_if the code compiles without errors, but using the requires-clause (see below) causes a compilation error when combined with the rest of the example. That is, the example contains two classes ClassA and ClassB. If either of the classes ClassA and ClassB are removed then the code compiles without errors. Compile with: g++ -std=c++20 example.cpp #include <type_traits> struct Base { Base() noexcept = default; template <typename F, typename DecayF = std::decay_t<F>> // If this requires-clause is replaces with an enable_if then the code compiles fine requires(!std::is_same_v<DecayF, Base> && std::is_constructible_v<DecayF, F>) Base(F&&) {} }; struct Derived : public Base { using Base::Base; void operator()() const; }; class ClassA { // The class ClassB must be present for the bug to manifest class ClassB; // This is the only usage of 'Derived' Derived const f; }; // This class and its contructor must be included for the bug to manifest class ClassA::ClassB { ClassB(); };