From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3F7553858D28; Wed, 25 Jan 2023 09:44:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F7553858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1674639889; bh=FPPmMjXX7mGV8aUyvjzM08A9T0R3+Qax7tNDejAAiVE=; h=From:To:Subject:Date:From; b=Ovtt6r4sZwFV7OQ4Zos7Nr2Cow6HB592KPA80xdOXv502OKx0KAA83+woie/3ICQq HHwlWDs/omUTNf/V5XL7E0f9naO5QlY9BjaXFkAZzaOH24arhwFDIa5bsy+nfVxyLy 75Ffib7xNs66g0H9TMced8KizqNMCzVnLIBn0t9A= From: "hr.jonas.hansen at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/108536] New: Difference when using requires and enable_if with class constructor Date: Wed, 25 Jan 2023 09:44:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hr.jonas.hansen at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108536 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 combi= ned with the rest of the example. That is, the example contains two classes Cla= ssA and ClassB. If either of the classes ClassA and ClassB are removed then the code compiles without errors. Compile with: g++ -std=3Dc++20 example.cpp #include struct Base { Base() noexcept =3D default; template > // If this requires-clause is replaces with an enable_if then the code compiles fine requires(!std::is_same_v && std::is_constructible_v) 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(); };=