public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102012] New: GCC accepts any non-bool atomic constraint type
@ 2021-08-22 15:14 hewillk at gmail dot com
  2021-08-23 10:05 ` [Bug c++/102012] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: hewillk at gmail dot com @ 2021-08-22 15:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102012
           Summary: GCC accepts any non-bool atomic constraint type
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

struct S { };

template<class T>
concept C = T(true);

decltype(C<int>) x = 0;
decltype(C<double>) y = 0;
decltype(C<const char*>) z = 0;
decltype(C<S>) w = 0;

https://godbolt.org/z/vEEPboYcq

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

* [Bug c++/102012] GCC accepts any non-bool atomic constraint type
  2021-08-22 15:14 [Bug c++/102012] New: GCC accepts any non-bool atomic constraint type hewillk at gmail dot com
@ 2021-08-23 10:05 ` redi at gcc dot gnu.org
  2021-08-23 14:28 ` 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-08-23 10:05 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-23
             Status|UNCONFIRMED                 |NEW
             Blocks|                            |67491


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

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

* [Bug c++/102012] GCC accepts any non-bool atomic constraint type
  2021-08-22 15:14 [Bug c++/102012] New: GCC accepts any non-bool atomic constraint type hewillk at gmail dot com
  2021-08-23 10:05 ` [Bug c++/102012] " redi at gcc dot gnu.org
@ 2021-08-23 14:28 ` ppalka at gcc dot gnu.org
  2021-08-23 14:39 ` hewillk at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-08-23 14:28 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Hmm, I think this might actually be well-formed according to [temp.names]/9.  I
don't see why we'd need to check satisfaction of a concept-id inside decltype
if its type is already prescribed to be bool.

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

* [Bug c++/102012] GCC accepts any non-bool atomic constraint type
  2021-08-22 15:14 [Bug c++/102012] New: GCC accepts any non-bool atomic constraint type hewillk at gmail dot com
  2021-08-23 10:05 ` [Bug c++/102012] " redi at gcc dot gnu.org
  2021-08-23 14:28 ` ppalka at gcc dot gnu.org
@ 2021-08-23 14:39 ` hewillk at gmail dot com
  2021-08-24 16:56 ` hewillk at gmail dot com
  2021-08-24 17:28 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: hewillk at gmail dot com @ 2021-08-23 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Patrick Palka from comment #1)
> Hmm, I think this might actually be well-formed according to [temp.names]/9.
> I don't see why we'd need to check satisfaction of a concept-id inside
> decltype if its type is already prescribed to be bool.

You are right..

template<class T>
concept C = T{}.foo();

decltype(C<int>) x = 0;

https://godbolt.org/z/zr5qhfGPY

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

* [Bug c++/102012] GCC accepts any non-bool atomic constraint type
  2021-08-22 15:14 [Bug c++/102012] New: GCC accepts any non-bool atomic constraint type hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2021-08-23 14:39 ` hewillk at gmail dot com
@ 2021-08-24 16:56 ` hewillk at gmail dot com
  2021-08-24 17:28 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: hewillk at gmail dot com @ 2021-08-24 16:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from 康桓瑋 <hewillk at gmail dot com> ---
(In reply to Patrick Palka from comment #1)
> Hmm, I think this might actually be well-formed according to [temp.names]/9.
> I don't see why we'd need to check satisfaction of a concept-id inside
> decltype if its type is already prescribed to be bool.

"The standard requires MSVC/Clang's behavior of erroring out." from
https://stackoverflow.com/a/68910627/11638718.

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

* [Bug c++/102012] GCC accepts any non-bool atomic constraint type
  2021-08-22 15:14 [Bug c++/102012] New: GCC accepts any non-bool atomic constraint type hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2021-08-24 16:56 ` hewillk at gmail dot com
@ 2021-08-24 17:28 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-08-24 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
(In reply to 康桓瑋 from comment #3)
> (In reply to Patrick Palka from comment #1)
> > Hmm, I think this might actually be well-formed according to [temp.names]/9.
> > I don't see why we'd need to check satisfaction of a concept-id inside
> > decltype if its type is already prescribed to be bool.
> 
> "The standard requires MSVC/Clang's behavior of erroring out." from
> https://stackoverflow.com/a/68910627/11638718.

Yes, evaluation of the concept-id should produce an error during satisfaction
due to the non-bool constraint.  But why should we evaluate a concept-id inside
decltype in the first place, when the type of a concept-id is always prescribed
to be bool?

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

end of thread, other threads:[~2021-08-24 17:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22 15:14 [Bug c++/102012] New: GCC accepts any non-bool atomic constraint type hewillk at gmail dot com
2021-08-23 10:05 ` [Bug c++/102012] " redi at gcc dot gnu.org
2021-08-23 14:28 ` ppalka at gcc dot gnu.org
2021-08-23 14:39 ` hewillk at gmail dot com
2021-08-24 16:56 ` hewillk at gmail dot com
2021-08-24 17:28 ` 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).