view gcc/testsuite/g++.dg/cpp0x/pr85437-1.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
line wrap: on
line source

// PR c++/85437
// { dg-do compile { target c++11 } }

struct A { int a; constexpr A() : a(0) {} };
struct B : A { int x; constexpr B() : x(0) {} };
struct X { int z; constexpr X() : z(0) {} };
struct C : X, B {};
constexpr int C::*cbx = &B::x;
constexpr int B::*bx = &B::x;
constexpr int A::*abx = static_cast<int(A::*)>(&B::x);	// { dg-bogus "not a constant expression" }

constexpr const C y;
constexpr const B& yb = y;
constexpr const A& ya = y;
constexpr int const *pcbx = &(y.*cbx);
constexpr int const *pbx = &(y.*bx);
constexpr int const *pabx = &(ya.*abx);