PR c++/87398 * constexpr.c (cxx_eval_constant_expression) <case OBJ_TYPE_REF>: Only look through COMPONENT_REFs with DECL_FIELD_IS_BASE FIELD_DECLs. * g++.dg/other/pr87398.C: New test. * g++.dg/cpp2a/constexpr-virtual10.C: New test. * g++.dg/cpp2a/constexpr-virtual11.C: New test. From-SVN: r264580
19 lines
321 B
C
19 lines
321 B
C
// P1064R0
|
|
// { dg-do compile }
|
|
// { dg-options "-std=c++2a" }
|
|
|
|
struct X
|
|
{
|
|
constexpr virtual int f() const { return 1; };
|
|
};
|
|
|
|
struct Y : public X
|
|
{
|
|
constexpr virtual int f() const { return 2; };
|
|
};
|
|
|
|
constexpr X a[2][1][3];
|
|
constexpr Y b[3][12];
|
|
static_assert (a[1][0][1].f() == 1);
|
|
static_assert (b[2][11].f() == 2);
|