Add -Wclass-conversion.
[platform/upstream/gcc.git] / gcc / testsuite / g++.dg / warn / Wclass-conversion2.C
1 // PR c++/87357
2 // { dg-do compile }
3 // { dg-options "-Wno-class-conversion" }
4
5 struct B { };
6
7 struct X : public B {
8   operator X(); // { dg-bogus "3:converting .X. to the same type will never use a type conversion operator" }
9   operator X&(); // { dg-bogus "3:converting .X. to a reference to the same type will never use a type conversion operator" }
10   operator X() const; // { dg-bogus "3:converting .X. to the same type will never use a type conversion operator" }
11   operator const X(); // { dg-bogus "3:converting .X. to the same type will never use a type conversion operator" }
12
13   operator B(); // { dg-bogus "3:converting .X. to a base class .B. will never use a type conversion operator" }
14   operator B&(); // { dg-bogus "3:converting .X. to a reference to a base class .B. will never use a type conversion operator" }
15   operator B() const; // { dg-bogus "3:converting .X. to a base class .B. will never use a type conversion operator" }
16   operator const B(); // { dg-bogus "3:converting .X. to a base class .const B. will never use a type conversion operator" }
17
18   operator void(); // { dg-bogus "3:converting .X. to .void. will never use a type conversion operator" }
19   operator void() const; // { dg-bogus "3:converting .X. to .void. will never use a type conversion operator" }
20 };