Bug 85438 - [8 Regression] invalid "a reinterpret_cast is not a constant expression" diagnostics since r249088
Summary: [8 Regression] invalid "a reinterpret_cast is not a constant expression" diag...
Status: RESOLVED DUPLICATE of bug 85437
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0
: P3 minor
Target Milestone: 8.0
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on: 70248
Blocks: constexpr
  Show dependency treegraph
 
Reported: 2018-04-17 14:55 UTC by Jakub Jelinek
Modified: 2024-01-13 17:02 UTC (History)
7 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2018-04-17 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2018-04-17 14:55:49 UTC
+++ This bug was initially created as a clone of Bug #70248 +++

struct A {};
struct B : A { int x; };
constexpr int A::*bx = (int(A::*))&B::x;

is rejected since r249088 with:
pr70248-2.C:3:24: error: a reinterpret_cast is not a constant expression
 constexpr int A::*bx = (int(A::*))&B::x;
                        ^~~~~~~~~~~~~
Comment 1 Jakub Jelinek 2018-04-17 14:56:34 UTC
clang++ and older g++ accept it.
Comment 2 Jakub Jelinek 2018-04-17 15:01:42 UTC
There is one NOP_EXPR created by

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