public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/92411] conformance issue with reinterpret_cast in constant expressions
       [not found] <bug-92411-4@http.gcc.gnu.org/bugzilla/>
@ 2020-07-22 13:29 ` wjwray at gmail dot com
  2020-07-22 15:30 ` wjwray at gmail dot com
  1 sibling, 0 replies; 2+ messages in thread
From: wjwray at gmail dot com @ 2020-07-22 13:29 UTC (permalink / raw)
  To: gcc-bugs

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

Will Wray <wjwray at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wjwray at gmail dot com

--- Comment #3 from Will Wray <wjwray at gmail dot com> ---
This particular cast, from const char array to const char pointer, is implicit
so static_cast suffices (and the reinterpret_cast is implictly a static_cast).

Editing your code sample to change reinterpret_cast to static_cast
it is accepted without diagnostic on gcc, clang, msvc, icc
https://gcc.godbolt.org/z/6a694c

The final comment on the bug linked as a possible duplicate shows that
some fixes were committed last month, fixing other cases.
I guess this particular case can be closed.

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

* [Bug c++/92411] conformance issue with reinterpret_cast in constant expressions
       [not found] <bug-92411-4@http.gcc.gnu.org/bugzilla/>
  2020-07-22 13:29 ` [Bug c++/92411] conformance issue with reinterpret_cast in constant expressions wjwray at gmail dot com
@ 2020-07-22 15:30 ` wjwray at gmail dot com
  1 sibling, 0 replies; 2+ messages in thread
From: wjwray at gmail dot com @ 2020-07-22 15:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Will Wray <wjwray at gmail dot com> ---
I mis-read this so was too hasty in suggesting "can be closed".
The standard states that a expression evaluation fails to be a constant
expression if it evaluates "reinterpret_cast" (i.e., by named token,
not by the actual strength of cast required, so seems to be the intent).
It's a 50/50 split with gcc & icc accepting, clang and msvc rejecting
https://gcc.godbolt.org/z/drdT66

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

end of thread, other threads:[~2020-07-22 15:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-92411-4@http.gcc.gnu.org/bugzilla/>
2020-07-22 13:29 ` [Bug c++/92411] conformance issue with reinterpret_cast in constant expressions wjwray at gmail dot com
2020-07-22 15:30 ` wjwray 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).