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
* [Bug c++/99961] requires clause rejects mentioning of function parameters too early
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 ` redi at gcc dot gnu.org
2021-04-11 15:33 ` ppalka at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-07 19:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99961
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2021-04-07
Keywords| |rejects-valid
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/99961] requires clause rejects mentioning of function parameters too early
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
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-11 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99961
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
CC| |ppalka at gcc dot gnu.org
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/99961] requires clause rejects mentioning of function parameters too early
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
4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-13 2:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99961
--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:59d9aa6d2efe7c52b6a986eb3e1977c1fb3c5753
commit r11-8144-g59d9aa6d2efe7c52b6a986eb3e1977c1fb3c5753
Author: Patrick Palka <ppalka@redhat.com>
Date: Mon Apr 12 22:54:55 2021 -0400
c++: constraints are unevaluated operands [PR99961]
According to [temp.concept]/6 and [temp.pre]/9, a concept definition and
a requires clause are both unevaluated contexts, and hence satisfaction
deals only with unevaluated operands, so we should set cp_unevaluated in
these three situations.
gcc/cp/ChangeLog:
PR c++/99961
PR c++/99994
* constraint.cc (satisfy_normalized_constraints): Set
cp_unevaluated.
* parser.c (cp_parser_concept_definition): Likewise.
(cp_parser_requires_clause_opt): Likewise.
gcc/testsuite/ChangeLog:
PR c++/99961
PR c++/99994
* g++.dg/cpp2a/concepts-uneval1.C: New test.
* g++.dg/cpp2a/concepts-uneval2.C: New test.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/99961] requires clause rejects mentioning of function parameters too early
2021-04-07 17:37 [Bug c++/99961] New: requires clause rejects mentioning of function parameters too early nickgray0 at brown dot edu
` (2 preceding siblings ...)
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
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-04-13 2:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99961
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
Resolution|--- |FIXED
Status|ASSIGNED |RESOLVED
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 11, thanks for the bug report.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/99961] requires clause rejects mentioning of function parameters too early
2021-04-07 17:37 [Bug c++/99961] New: requires clause rejects mentioning of function parameters too early nickgray0 at brown dot edu
` (3 preceding siblings ...)
2021-04-13 2:57 ` ppalka at gcc dot gnu.org
@ 2022-12-13 14:24 ` ppalka at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-12-13 14:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99961
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gccbugbjorn at fahller dot se
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 97837 has been marked as a duplicate of this bug. ***
^ 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).