Douglas Gregor | e14654b | 2010-01-29 19:42:41 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | namespace PR5909 { |
| 4 | struct Foo { |
| 5 | int x : 20; |
| 6 | }; |
| 7 | |
| 8 | bool Test(const int& foo); |
| 9 | |
| 10 | const Foo f = { 0 }; // It compiles without the 'const'. |
| 11 | bool z = Test(f.x); |
| 12 | } |
Douglas Gregor | 692f85c | 2010-02-26 01:17:27 +0000 | [diff] [blame] | 13 | |
| 14 | namespace PR6264 { |
| 15 | typedef int (&T)[3]; |
| 16 | struct S |
| 17 | { |
| 18 | operator T (); |
| 19 | }; |
| 20 | void f() |
| 21 | { |
| 22 | T bar = S(); |
| 23 | } |
| 24 | } |
Douglas Gregor | d1fed3e | 2010-04-13 15:07:45 +0000 | [diff] [blame] | 25 | |
| 26 | namespace PR6066 { |
| 27 | struct B { }; |
| 28 | struct A : B { |
| 29 | operator B*(); |
| 30 | operator B&(); // expected-warning{{conversion function converting 'PR6066::A' to its base class 'PR6066::B' will never be used}} |
| 31 | }; |
| 32 | |
| 33 | void f(B&); // no rvalues accepted |
| 34 | void f(B*); |
| 35 | |
| 36 | int g() { |
| 37 | f(A()); // calls f(B*) |
| 38 | return 0; |
| 39 | } |
| 40 | } |