comparison gcc/testsuite/g++.dg/cpp1z/inh-ctor38.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // { dg-do run { target c++11 } }
2 // PR78495 failed to propagate pass-by-value struct to base ctor.
3
4 struct Ptr {
5 void *ptr = 0;
6
7 Ptr() {}
8 Ptr(Ptr const&) = delete;
9 Ptr(Ptr&& other) : ptr (other.ptr) {}
10 };
11
12 struct Base {
13 Ptr val;
14 Base(Ptr val_) : val(static_cast<Ptr&&>(val_)) {}
15 };
16
17 struct Derived: Base {
18 using Base::Base;
19 };
20
21 void *Foo () {
22 Ptr ptr;
23
24 Derived d(static_cast<Ptr&&>(ptr));
25
26 return d.val.ptr;
27 }
28
29 int main () {
30 return Foo () != 0;
31 }