From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 94AB7385114A; Thu, 27 Oct 2022 16:22:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94AB7385114A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666887751; bh=I4Gza1z8CRjCEG4cOxNnb5yRFvTMVgkaGeNQZCCWpJw=; h=From:To:Subject:Date:From; b=p6aURth3U+UlYbP8qH+XTWA5LxC1oIoc5O2iXT1czSheWaEwYJoJRGG2wvawNIang mUhEbULFh4f+Ixd+M98l5nlB2HxIbiyHLc8QfKfAzkJH4y6ODFBSoFppgFRSyr5DeJ SIoIEsEpgEpNJ60wCQwanxa/BX+NjJb55peld56U= From: "jwjagersma at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107439] New: use of static member function in requires-expression depends on declaration order Date: Thu, 27 Oct 2022 16:22:19 +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: jwjagersma 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=3D107439 Bug ID: 107439 Summary: use of static member function in requires-expression depends on declaration order Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jwjagersma at gmail dot com Target Milestone: --- The following example fails to compile, as g++ complains that a declaration= of 'check' is not available. Reordering it so that 'check' is declared before its use in the requires-expression makes it work. This seems inconsistent,= as member functions are normally expected to be usable anywhere within the cla= ss definition. $ cat requires-memfn.cpp struct A { template requires (check()) auto func(T) { } template static consteval bool check() { return true; } }; $ g++ -std=3Dc++20 requires-memfn.cpp requires-memfn.cpp:3:34: error: there are no arguments to =E2=80=98check= =E2=80=99 that depend on a template parameter, so a declaration of =E2=80=98check=E2=80=99 must be available [-fpermissive] 3 | template requires (check()) | ^~~~~~~~ requires-memfn.cpp:3:34: note: (if you use =E2=80=98-fpermissive=E2=80=99= , G++ will accept your code, but allowing the use of an undeclared name is deprecated)=