public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95153] New: Arrays of 'const void *' should not be copyable
@ 2020-05-15 13:37 alisdairm at me dot com
2020-05-15 14:02 ` [Bug c++/95153] " alisdairm at me dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: alisdairm at me dot com @ 2020-05-15 13:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95153
Bug ID: 95153
Summary: Arrays of 'const void *' should not be copyable
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: alisdairm at me dot com
Target Milestone: ---
In general, we do not expect array types to be copyable according to the
'is_copy_constructible_v' trait. However, the following started passing in gcc
10:
#include <type_traits>
static_assert(!std::is_copy_constructible_v<const void *[13]>);
Note that the 'const' is important, arrays of 'void *' remain non-copyable
according to the trait.
'void' may be a specific trigger too, as arrays of 'const int *' do not have
this problem.
Finally, the array bound does not seem significant, other than it gives the
expected answer again for an array of unknown bound.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95153] Arrays of 'const void *' should not be copyable
2020-05-15 13:37 [Bug c++/95153] New: Arrays of 'const void *' should not be copyable alisdairm at me dot com
@ 2020-05-15 14:02 ` alisdairm at me dot com
2020-05-15 16:39 ` [Bug c++/95153] Arrays of 'const void *' should not be copyable in C++20 rs2740 at gmail dot com
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: alisdairm at me dot com @ 2020-05-15 14:02 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95153
--- Comment #1 from Alisdair Meredith <alisdairm at me dot com> ---
Forgot to add this is specific to -std=c++20 too.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95153] Arrays of 'const void *' should not be copyable in C++20
2020-05-15 13:37 [Bug c++/95153] New: Arrays of 'const void *' should not be copyable alisdairm at me dot com
2020-05-15 14:02 ` [Bug c++/95153] " alisdairm at me dot com
@ 2020-05-15 16:39 ` rs2740 at gmail dot com
2020-07-06 12:28 ` alisdairm at me dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rs2740 at gmail dot com @ 2020-05-15 16:39 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95153
TC <rs2740 at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |rs2740 at gmail dot com
--- Comment #2 from TC <rs2740 at gmail dot com> ---
This is behaving as specified.
const void* const a[10];
const void* const b[10](a);
is valid code in C++20; it initializes b[0] with &a[0] converted to a const
void*, and the rest of b with null pointers.
The void* case is
void* const a[10];
void* const b[10](a);
which is invalid because &a[0] is a void* const*; converting that to void* is
not allowed because it casts away constness.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95153] Arrays of 'const void *' should not be copyable in C++20
2020-05-15 13:37 [Bug c++/95153] New: Arrays of 'const void *' should not be copyable alisdairm at me dot com
2020-05-15 14:02 ` [Bug c++/95153] " alisdairm at me dot com
2020-05-15 16:39 ` [Bug c++/95153] Arrays of 'const void *' should not be copyable in C++20 rs2740 at gmail dot com
@ 2020-07-06 12:28 ` alisdairm at me dot com
2020-07-06 12:52 ` redi at gcc dot gnu.org
2022-03-11 18:29 ` barry.revzin at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: alisdairm at me dot com @ 2020-07-06 12:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95153
--- Comment #3 from Alisdair Meredith <alisdairm at me dot com> ---
Sorry, thought I had confirmed that I agree with the analysis above - this is a
(perhaps surprising) change to the specification of C++20.
What is the best way to withdraw this report as invalid?
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95153] Arrays of 'const void *' should not be copyable in C++20
2020-05-15 13:37 [Bug c++/95153] New: Arrays of 'const void *' should not be copyable alisdairm at me dot com
` (2 preceding siblings ...)
2020-07-06 12:28 ` alisdairm at me dot com
@ 2020-07-06 12:52 ` redi at gcc dot gnu.org
2022-03-11 18:29 ` barry.revzin at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-06 12:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95153
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Status -> RESOLVED INVALID
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95153] Arrays of 'const void *' should not be copyable in C++20
2020-05-15 13:37 [Bug c++/95153] New: Arrays of 'const void *' should not be copyable alisdairm at me dot com
` (3 preceding siblings ...)
2020-07-06 12:52 ` redi at gcc dot gnu.org
@ 2022-03-11 18:29 ` barry.revzin at gmail dot com
4 siblings, 0 replies; 6+ messages in thread
From: barry.revzin at gmail dot com @ 2022-03-11 18:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95153
Barry Revzin <barry.revzin at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |barry.revzin at gmail dot com
--- Comment #5 from Barry Revzin <barry.revzin at gmail dot com> ---
Just to follow up, gcc trunk right now does this:
int main() {
int a[3]{};
void const* b[3](a); // ok
void const* c[3]{};
void const* d[3](c); // error: array must be initialized with a
brace-enclosed initializer
}
If 'd' is actually an error, then it's not because of that, so at the very
least, the diagnostic is wrong.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-03-11 18:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-15 13:37 [Bug c++/95153] New: Arrays of 'const void *' should not be copyable alisdairm at me dot com
2020-05-15 14:02 ` [Bug c++/95153] " alisdairm at me dot com
2020-05-15 16:39 ` [Bug c++/95153] Arrays of 'const void *' should not be copyable in C++20 rs2740 at gmail dot com
2020-07-06 12:28 ` alisdairm at me dot com
2020-07-06 12:52 ` redi at gcc dot gnu.org
2022-03-11 18:29 ` barry.revzin 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).