public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96840] New: Recursive substitution in constrained commutative operator
@ 2020-08-29 0:29 johelegp at gmail dot com
2020-08-31 6:31 ` [Bug c++/96840] [11 Regression] " rguenth at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: johelegp at gmail dot com @ 2020-08-29 0:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96840
Bug ID: 96840
Summary: Recursive substitution in constrained commutative
operator
Product: gcc
Version: 11.0
URL: https://godbolt.org/z/cedacs
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: johelegp at gmail dot com
Target Milestone: ---
I may be wrong, but I think this should compile. Clang accepts it as does GCC
10.2 and did the GCC 11 build from a little while ago.
See the URL:
```C++
template <class T, class U> concept C = requires(T t, U u) { t * u; };
template <class Rep> struct Int {
template <class T> requires C<T, Rep> friend void operator*(T, Int) { }
template <class T> requires C<T, Rep> friend void operator*(Int, T) { }
};
void f() { 0 * Int<int>{}; }
```
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/96840] [11 Regression] Recursive substitution in constrained commutative operator
2020-08-29 0:29 [Bug c++/96840] New: Recursive substitution in constrained commutative operator johelegp at gmail dot com
@ 2020-08-31 6:31 ` rguenth at gcc dot gnu.org
2020-09-28 15:33 ` ppalka at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-31 6:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96840
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Target Milestone|--- |11.0
Summary|Recursive substitution in |[11 Regression] Recursive
|constrained commutative |substitution in constrained
|operator |commutative operator
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/96840] [11 Regression] Recursive substitution in constrained commutative operator
2020-08-29 0:29 [Bug c++/96840] New: Recursive substitution in constrained commutative operator johelegp at gmail dot com
2020-08-31 6:31 ` [Bug c++/96840] [11 Regression] " rguenth at gcc dot gnu.org
@ 2020-09-28 15:33 ` ppalka at gcc dot gnu.org
2020-10-16 12:05 ` rguenth at gcc dot gnu.org
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-09-28 15:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96840
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r11-2774:
c++: Check satisfaction before non-dep convs. [CWG2369]
It's very hard to use concepts to protect a template from hard errors due
to
unwanted instantiation if constraints aren't checked until after doing all
substitution and checking of non-dependent conversions.
We fall into a loop when checking the constraints of the second overload
(instantiated with Rep=int and T=Int<int>).
It looks like we're correct to reject the testcase as of this DR?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/96840] [11 Regression] Recursive substitution in constrained commutative operator
2020-08-29 0:29 [Bug c++/96840] New: Recursive substitution in constrained commutative operator johelegp at gmail dot com
2020-08-31 6:31 ` [Bug c++/96840] [11 Regression] " rguenth at gcc dot gnu.org
2020-09-28 15:33 ` ppalka at gcc dot gnu.org
@ 2020-10-16 12:05 ` rguenth at gcc dot gnu.org
2020-12-18 3:36 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-16 12:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96840
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Ever confirmed|0 |1
Last reconfirmed| |2020-10-16
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/96840] [11 Regression] Recursive substitution in constrained commutative operator
2020-08-29 0:29 [Bug c++/96840] New: Recursive substitution in constrained commutative operator johelegp at gmail dot com
` (2 preceding siblings ...)
2020-10-16 12:05 ` rguenth at gcc dot gnu.org
@ 2020-12-18 3:36 ` cvs-commit at gcc dot gnu.org
2021-02-01 17:58 ` ppalka at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-12-18 3:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96840
--- Comment #2 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:79f57d5cb070bb02ea0a34b5f42658d6659b19a8
commit r11-6245-g79f57d5cb070bb02ea0a34b5f42658d6659b19a8
Author: Patrick Palka <ppalka@redhat.com>
Date: Thu Dec 17 22:18:07 2020 -0500
c++: Diagnose self-recursive satisfaction
This patch further extends the satisfaction_cache class to diagnose
self-recursive satisfaction.
gcc/cp/ChangeLog:
* constraint.cc (sat_entry::evaluating): New member.
(satisfaction_cache::get): If entry->evaluating, diagnose
self-recursive satisfaction. Otherwise, set entry->evaluating
if we're not reusing a cached satisfaction result.
(satisfaction_cache::save): Clear entry->evaluating.
(satisfy_atom): Set up diagnosing_failed_constraint before the
first call to get().
gcc/testsuite/ChangeLog:
PR c++/96840
* g++.dg/cpp2a/concepts-pr88395.C: Adjust to expect the
self-recursive satisfaction to get directly diagnosed.
* g++.dg/cpp2a/concepts-recursive-sat2.C: Likewise.
* g++.dg/cpp2a/concepts-recursive-sat4.C: New test.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/96840] [11 Regression] Recursive substitution in constrained commutative operator
2020-08-29 0:29 [Bug c++/96840] New: Recursive substitution in constrained commutative operator johelegp at gmail dot com
` (3 preceding siblings ...)
2020-12-18 3:36 ` cvs-commit at gcc dot gnu.org
@ 2021-02-01 17:58 ` ppalka at gcc dot gnu.org
2021-12-30 14:06 ` johelegp at gmail dot com
2021-12-30 14:23 ` johelegp at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-02-01 17:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96840
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|WAITING |RESOLVED
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
With the above patch we now detect and diagnose the self-recursive satisfaction
in the testcase:
96840.C: In substitution of ‘template<class T> requires C<T, Rep> void
operator*(T, Int<int>) [with T = int]’:
96840.C:1:64: required by substitution of ‘template<class T> requires C<T,
Rep> void operator*(Int<int>, T) [with T = int]’
96840.C:6:28: required from here
96840.C:1:37: required for the satisfaction of ‘C<T, Rep>’ [with T =
Int<int>; Rep = int]
96840.C:1:41: in requirements with ‘T t’, ‘U u’ [with U = int; T = Int<int>]
96840.C:1:41: error: satisfaction of atomic constraint ‘requires(T t, U u) {t *
u;} [with U = Rep; T = T]’ depends on itself
1 | template <class T, class U> concept C = requires(T t, U u) { t * u; };
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
So I suppose we can mark this PR as resolved.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/96840] [11 Regression] Recursive substitution in constrained commutative operator
2020-08-29 0:29 [Bug c++/96840] New: Recursive substitution in constrained commutative operator johelegp at gmail dot com
` (4 preceding siblings ...)
2021-02-01 17:58 ` ppalka at gcc dot gnu.org
@ 2021-12-30 14:06 ` johelegp at gmail dot com
2021-12-30 14:23 ` johelegp at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: johelegp at gmail dot com @ 2021-12-30 14:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96840
--- Comment #4 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Seems like this regressed. Do I open a new bug report?
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/96840] [11 Regression] Recursive substitution in constrained commutative operator
2020-08-29 0:29 [Bug c++/96840] New: Recursive substitution in constrained commutative operator johelegp at gmail dot com
` (5 preceding siblings ...)
2021-12-30 14:06 ` johelegp at gmail dot com
@ 2021-12-30 14:23 ` johelegp at gmail dot com
6 siblings, 0 replies; 8+ messages in thread
From: johelegp at gmail dot com @ 2021-12-30 14:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96840
--- Comment #5 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
I think I was wrong and this has not regressed.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-12-30 14:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-29 0:29 [Bug c++/96840] New: Recursive substitution in constrained commutative operator johelegp at gmail dot com
2020-08-31 6:31 ` [Bug c++/96840] [11 Regression] " rguenth at gcc dot gnu.org
2020-09-28 15:33 ` ppalka at gcc dot gnu.org
2020-10-16 12:05 ` rguenth at gcc dot gnu.org
2020-12-18 3:36 ` cvs-commit at gcc dot gnu.org
2021-02-01 17:58 ` ppalka at gcc dot gnu.org
2021-12-30 14:06 ` johelegp at gmail dot com
2021-12-30 14:23 ` johelegp at gmail dot com
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).