From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0DF4B38708F1; Wed, 10 Mar 2021 14:33:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DF4B38708F1 From: "nickgray0 at brown dot edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/99518] New: trailing requires clause adds nonexistent reference declarator to function parameter Date: Wed, 10 Mar 2021 14:32:59 +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: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nickgray0 at brown dot edu 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 14:33:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99518 Bug ID: 99518 Summary: trailing requires clause adds nonexistent reference declarator to function parameter Product: gcc Version: 11.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nickgray0 at brown dot edu Target Milestone: --- the following code fails to compile #include auto f(std::integral auto x) {} auto g(auto x) requires requires { { x }->std::integral; } {} auto main()->int { f(42); // OK g(42); // error } error message: In function 'int main()': :8:9: error: no matching function for call to 'g(int)' 8 | g(42); // error | ^ :4:6: note: candidate: 'template auto g(auto:2) requi= res requires{{g::x} -> decltype(auto) [requires std::integral<, >]= ;}' 4 | auto g(auto x) requires requires { { x }->std::integral; } {} | ^ :4:6: note: template argument deduction/substitution failed: :4:6: note: constraints not satisfied : In substitution of 'template auto g(auto:2) requires requires{{x} -> decltype(auto) [requires std::integral<, >];} [with auto:2 =3D int]': :8:9: required from here :4:6: required by the constraints of 'template auto g(auto:2) requires requires{{x} -> decltype(auto) [requires std::integral<, >];}' :4:25: in requirements [with auto:2 =3D int] :4:38: note: 'x' does not satisfy return-type-requirement, because 4 | auto g(auto x) requires requires { { x }->std::integral; } {} | ^ :4:38: error: deduced expression type does not satisfy placeholder constraints 4 | auto g(auto x) requires requires { { x }->std::integral; } {} | ~~^~~~~~~~~~~~~~~~~~ :4:38: note: constraints not satisfied In file included from :1: /opt/compiler-explorer/gcc-trunk-20210310/include/c++/11.0.1/concepts:102:1= 3:=20=20 required for the satisfaction of 'integral, >]>' [with decltype(auto) [requires std::integral<, >] =3D int&] /opt/compiler-explorer/gcc-trunk-20210310/include/c++/11.0.1/concepts:102:2= 4: note: the expression 'is_integral_v<_Tp> [with _Tp =3D int&]' evaluated to 'false' 102 | concept integral =3D is_integral_v<_Tp>;=