aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/constexpr-virtual16.C
blob: 8cca8a617235ce2fbaeb2b2bf5583a4c4703efaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Test constexpr virtual in non-primary vtable.
// { dg-do compile { target c++20 } }

struct A
{
  virtual constexpr int f() const { return 1; };
};

struct B
{
  virtual constexpr int g() const { return 2; };
};

struct C: A, B
{
};

constexpr C c;

constexpr int g(const B& b) { return b.g(); }
static_assert (g(c) == 2);