1 // PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wconversion" }
4
5 struct B;
6
7 struct A {
8 operator B();
9 };
10
11 struct B {
12 B(A const &rs);
13 B(B const &rs);
14 };
15
16 B
f(A x)17 f (A x)
18 {
19 // C++14: we call B::B(A const &)
20 // C++17: we call A::operator B()
21 return B(x); // { dg-warning "choosing .A::operator B\\(\\). over .B::B\\(const A&\\)" "" { target c++17 } }
22 // { dg-warning "for conversion from .A. to .B." "" { target c++17 } .-1 }
23 }
24