blob: 3c411fa3fcca066dd2f3d3387afdf472245703f9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// Test for constexpr call through vbase thunk.
// { dg-do compile { target c++20 } }
class Rep {
public:
constexpr virtual int foo() { return 1; }
};
class VBase {
public:
constexpr virtual int foo() { return 2; }
};
class Main : public Rep, virtual public VBase {
public:
constexpr virtual int foo() { return 5; }
};
int main() {
Main m;
static_assert(static_cast<VBase*>(&m)->foo() == 5); // { dg-error "" }
}
|