111
|
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 }
|