public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99961] New: requires clause rejects mentioning of function parameters too early
@ 2021-04-07 17:37 nickgray0 at brown dot edu
  2021-04-07 19:35 ` [Bug c++/99961] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: nickgray0 at brown dot edu @ 2021-04-07 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99961
           Summary: requires clause rejects mentioning of function
                    parameters too early
           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:

    struct A {
        static constexpr auto x = 42;
    };

    auto f(auto a) requires (a.x > 10) {}

    auto main()->int {
        f(A{});
    }

error message: <source>:5:27: error: use of parameter outside function body
before '.' token
    5 | auto f(auto a) requires (a.x > 10) {}
      |                           ^
<source>: In function 'int main()':
<source>:8:6: error: no matching function for call to 'f(A)'
    8 |     f(A{});
      |     ~^~~~~
<source>:5:6: note: candidate: 'template<class auto:1> auto f(auto:1) requires 
<erroneous-expression>'
    5 | auto f(auto a) requires (a.x > 10) {}
      |      ^
<source>:5:6: note:   template argument deduction/substitution failed:
<source>:5:6: note: constraints not satisfied



as shown in the example above, a.x doesn't *actually* make use of a

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

end of thread, other threads:[~2022-12-13 14:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 17:37 [Bug c++/99961] New: requires clause rejects mentioning of function parameters too early nickgray0 at brown dot edu
2021-04-07 19:35 ` [Bug c++/99961] " redi at gcc dot gnu.org
2021-04-11 15:33 ` ppalka at gcc dot gnu.org
2021-04-13  2:55 ` cvs-commit at gcc dot gnu.org
2021-04-13  2:57 ` ppalka at gcc dot gnu.org
2022-12-13 14:24 ` ppalka 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).