comparison gcc/testsuite/g++.dg/cpp2a/constexpr-virtual6.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents
children
comparison
equal deleted inserted replaced
111:04ced10e8804 131:84e7813d76e9
1 // P1064R0
2 // { dg-do compile }
3 // { dg-options "-std=c++2a" }
4
5 struct X1
6 {
7 constexpr virtual X1 const *f() const { return this; }
8 };
9
10 struct Y
11 {
12 int m = 0;
13 };
14
15 struct X2: public Y, public X1
16 {
17 constexpr virtual X2 const *f() const { return this; }
18 };
19
20 constexpr X1 x1;
21 static_assert(x1.f() == &x1);
22
23 constexpr X2 x2;
24 constexpr X1 const& r2 = x2;
25 static_assert(r2.f() == &r2);