public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115594] New: requires expression permits arrays of voids
@ 2024-06-22 21:32 fchelnokov at gmail dot com
  2024-06-22 21:41 ` [Bug c++/115594] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fchelnokov at gmail dot com @ 2024-06-22 21:32 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115594
           Summary: requires expression permits arrays of voids
           Product: gcc
           Version: 14.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This program
```
template<typename T>
concept C = requires(T t[2]) {
    t;
};

static_assert(!C<void>);
```
seems valid because arrays of voids are not allowed, and it is accepted by
Clang and MSVC. But in GCC static_assert evaluates to opposite value. Online
demo: https://gcc.godbolt.org/z/nM8Mj8qrb

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

* [Bug c++/115594] requires expression permits arrays of voids
  2024-06-22 21:32 [Bug c++/115594] New: requires expression permits arrays of voids fchelnokov at gmail dot com
@ 2024-06-22 21:41 ` pinskia at gcc dot gnu.org
  2024-06-22 21:53 ` pinskia at gcc dot gnu.org
  2024-06-27  4:03 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-22 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The interesting thing is the reason why clang outputs:
<source>:2:25: note: because 't' would be invalid: array has incomplete element
type 'void'


Is not exactly correct as if you change void to being a incomplete type:
struct A;

static_assert(C<A>);

it is accepted by all compilers ...

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

* [Bug c++/115594] requires expression permits arrays of voids
  2024-06-22 21:32 [Bug c++/115594] New: requires expression permits arrays of voids fchelnokov at gmail dot com
  2024-06-22 21:41 ` [Bug c++/115594] " pinskia at gcc dot gnu.org
@ 2024-06-22 21:53 ` pinskia at gcc dot gnu.org
  2024-06-27  4:03 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-22 21:53 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think this is a dup of bug 24664.

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

* [Bug c++/115594] requires expression permits arrays of voids
  2024-06-22 21:32 [Bug c++/115594] New: requires expression permits arrays of voids fchelnokov at gmail dot com
  2024-06-22 21:41 ` [Bug c++/115594] " pinskia at gcc dot gnu.org
  2024-06-22 21:53 ` pinskia at gcc dot gnu.org
@ 2024-06-27  4:03 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-27  4:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Yes it is a dup.

The following should also be rejected but currently is not:
```
  template<class T, class T1 = int*(T[5])> int f(T*);
  int j=f<void>(nullptr);
```

Basically function arguments (including concepts "arguments") decay too early
for arrays to pointers.

*** This bug has been marked as a duplicate of bug 24664 ***

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

end of thread, other threads:[~2024-06-27  4:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-22 21:32 [Bug c++/115594] New: requires expression permits arrays of voids fchelnokov at gmail dot com
2024-06-22 21:41 ` [Bug c++/115594] " pinskia at gcc dot gnu.org
2024-06-22 21:53 ` pinskia at gcc dot gnu.org
2024-06-27  4:03 ` pinskia 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).