public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115617] New: Wrong diagnostic message for non-const expr in constexpr context
@ 2024-06-24 14:27 jengelh at inai dot de
2024-06-24 16:12 ` [Bug c++/115617] inconsistent diagnostic message for reinterpret_cast in constexpr context (enum vs integer constant) pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: jengelh at inai dot de @ 2024-06-24 14:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115617
Bug ID: 115617
Summary: Wrong diagnostic message for non-const expr in
constexpr context
Product: gcc
Version: 13.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jengelh at inai dot de
Target Milestone: ---
Input:
enum E { FOO = 2 };
int main()
{
static constexpr auto x = reinterpret_cast<void *>(static_cast<long>(FOO));
static constexpr auto y = reinterpret_cast<void *>(static_cast<long>(2));
}
Observed output:
$ g++ -c x.cpp -Wall -std=c++17
x.cpp: In function ‘int main()’:
x.cpp:4:29: error: ‘reinterpret_cast<void*>(2)’ is not a constant expression
x.cpp:5:29: error: ‘reinterpret_cast’ from integer to pointer
Expected output:
x.cpp: In function ‘int main()’:
x.cpp:4:29: error: ‘reinterpret_cast<void*>(2)’ is not a constant expression
x.cpp:5:29: error: ‘reinterpret_cast<void*>(2)’ is not a constant expression
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/115617] inconsistent diagnostic message for reinterpret_cast in constexpr context (enum vs integer constant)
2024-06-24 14:27 [Bug c++/115617] New: Wrong diagnostic message for non-const expr in constexpr context jengelh at inai dot de
@ 2024-06-24 16:12 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-06-24 16:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115617
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Wrong diagnostic message |inconsistent diagnostic
|for non-const expr in |message for
|constexpr context |reinterpret_cast in
| |constexpr context (enum vs
| |integer constant)
Last reconfirmed| |2024-06-24
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-24 16:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-24 14:27 [Bug c++/115617] New: Wrong diagnostic message for non-const expr in constexpr context jengelh at inai dot de
2024-06-24 16:12 ` [Bug c++/115617] inconsistent diagnostic message for reinterpret_cast in constexpr context (enum vs integer constant) 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).