public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail
@ 2023-03-29 18:55 cjdb.ns at gmail dot com
2023-03-29 18:59 ` [Bug c++/109337] " pinskia at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: cjdb.ns at gmail dot com @ 2023-03-29 18:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337
Bug ID: 109337
Summary: c++2a test concepts4.C passes when it should fail
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: cjdb.ns at gmail dot com
Target Milestone: ---
Clang and GCC disagree on the validity of concepts4.C. I think Clang is correct
here, because forming a reference to `void` should be ill-formed.
https://godbolt.org/z/es5GxYhzd
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109337] c++2a test concepts4.C passes when it should fail
2023-03-29 18:55 [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail cjdb.ns at gmail dot com
@ 2023-03-29 18:59 ` pinskia at gcc dot gnu.org
2023-03-29 19:02 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-29 18:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-03-29
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
Changing R42c to be a bool rather than a concept causes GCC to catch the
failure ...
That is:
```
template <class T> struct A { static const int x = 42; };
template <class Ta> concept A42 = A<Ta>::x == 42;
template <class Tv> concept Void = __is_same_as(Tv, void);
template <class Tb, class Ub> concept A42b = Void<Tb> || A42<Ub>;
template <class Tc> bool R42c = A42b<Tc, Tc&>;
static_assert (R42c<void>);
```
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109337] c++2a test concepts4.C passes when it should fail
2023-03-29 18:55 [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail cjdb.ns at gmail dot com
2023-03-29 18:59 ` [Bug c++/109337] " pinskia at gcc dot gnu.org
@ 2023-03-29 19:02 ` pinskia at gcc dot gnu.org
2023-03-29 19:08 ` cjdb.ns at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-29 19:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
template <class Ub> concept A42b = true;
template <class Tc> concept R42c = A42b<Tc&>;
static_assert (R42c<void>);
```
GCC does the right thing for too:
```
template <class Ub> bool A42b = true;
template <class Tc> concept R42c = A42b<Tc&>;
static_assert (!R42c<void>);
```
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109337] c++2a test concepts4.C passes when it should fail
2023-03-29 18:55 [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail cjdb.ns at gmail dot com
2023-03-29 18:59 ` [Bug c++/109337] " pinskia at gcc dot gnu.org
2023-03-29 19:02 ` pinskia at gcc dot gnu.org
@ 2023-03-29 19:08 ` cjdb.ns at gmail dot com
2023-03-29 19:09 ` pinskia at gcc dot gnu.org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: cjdb.ns at gmail dot com @ 2023-03-29 19:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337
--- Comment #3 from Christopher Di Bella <cjdb.ns at gmail dot com> ---
This is apparently a Clang bug: the RHS of `R42c` isn't evaluated because of
short-circuiting. Apologies for the noise and thanks for helping me work
through it.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109337] c++2a test concepts4.C passes when it should fail
2023-03-29 18:55 [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail cjdb.ns at gmail dot com
` (2 preceding siblings ...)
2023-03-29 19:08 ` cjdb.ns at gmail dot com
@ 2023-03-29 19:09 ` pinskia at gcc dot gnu.org
2023-03-29 19:11 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-29 19:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|NEW |RESOLVED
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
invalid as noticed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109337] c++2a test concepts4.C passes when it should fail
2023-03-29 18:55 [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail cjdb.ns at gmail dot com
` (3 preceding siblings ...)
2023-03-29 19:09 ` pinskia at gcc dot gnu.org
@ 2023-03-29 19:11 ` pinskia at gcc dot gnu.org
2023-03-29 20:13 ` richard-gccbugzilla at metafoo dot co.uk
2023-03-30 17:08 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-29 19:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |NEW
Resolution|INVALID |---
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Christopher Di Bella from comment #3)
> This is apparently a Clang bug: the RHS of `R42c` isn't evaluated because of
> short-circuiting. Apologies for the noise and thanks for helping me work
> through it.
No, clang and GCC disagree even on:
```
template <class Ub> concept A42b = true;
template <class Tc> concept R42c = A42b<Tc&>;
static_assert (R42c<void>);
```
There is no short-circuting here.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109337] c++2a test concepts4.C passes when it should fail
2023-03-29 18:55 [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail cjdb.ns at gmail dot com
` (4 preceding siblings ...)
2023-03-29 19:11 ` pinskia at gcc dot gnu.org
@ 2023-03-29 20:13 ` richard-gccbugzilla at metafoo dot co.uk
2023-03-30 17:08 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2023-03-29 20:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337
Richard Smith <richard-gccbugzilla at metafoo dot co.uk> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |richard-gccbugzilla@metafoo
| |.co.uk
--- Comment #6 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
(In reply to Andrew Pinski from comment #5)
> (In reply to Christopher Di Bella from comment #3)
> > This is apparently a Clang bug: the RHS of `R42c` isn't evaluated because of
> > short-circuiting. Apologies for the noise and thanks for helping me work
> > through it.
>
> No, clang and GCC disagree even on:
> ```
> template <class Ub> concept A42b = true;
> template <class Tc> concept R42c = A42b<Tc&>;
>
> static_assert (R42c<void>);
> ```
>
> There is no short-circuting here.
No substitution is performed into 'Tc&' here, because normalization of R42c
produces the atomic constraint 'true' with an empty parameter mapping. So the
type 'void&' is never formed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/109337] c++2a test concepts4.C passes when it should fail
2023-03-29 18:55 [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail cjdb.ns at gmail dot com
` (5 preceding siblings ...)
2023-03-29 20:13 ` richard-gccbugzilla at metafoo dot co.uk
@ 2023-03-30 17:08 ` ppalka at gcc dot gnu.org
6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-30 17:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109337
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
CC| |ppalka at gcc dot gnu.org
Status|NEW |RESOLVED
--- Comment #7 from Patrick Palka <ppalka at gcc dot gnu.org> ---
dup of PR102419 AFAICT
*** This bug has been marked as a duplicate of bug 102419 ***
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-03-30 17:08 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-29 18:55 [Bug c++/109337] New: c++2a test concepts4.C passes when it should fail cjdb.ns at gmail dot com
2023-03-29 18:59 ` [Bug c++/109337] " pinskia at gcc dot gnu.org
2023-03-29 19:02 ` pinskia at gcc dot gnu.org
2023-03-29 19:08 ` cjdb.ns at gmail dot com
2023-03-29 19:09 ` pinskia at gcc dot gnu.org
2023-03-29 19:11 ` pinskia at gcc dot gnu.org
2023-03-29 20:13 ` richard-gccbugzilla at metafoo dot co.uk
2023-03-30 17:08 ` 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).