diff options
Diffstat (limited to 'test/SemaCXX/overload-call.cpp')
-rw-r--r-- | test/SemaCXX/overload-call.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/SemaCXX/overload-call.cpp b/test/SemaCXX/overload-call.cpp index 29133c7..6bf6965 100644 --- a/test/SemaCXX/overload-call.cpp +++ b/test/SemaCXX/overload-call.cpp @@ -54,6 +54,7 @@ double* k(bool); void test_k() { int* ip1 = k("foo"); // expected-warning{{conversion from string literal to 'char *' is deprecated}} + int* ip2 = k(("foo")); // expected-warning{{conversion from string literal to 'char *' is deprecated}} double* dp1 = k(L"foo"); } @@ -218,6 +219,12 @@ void test_derived(B* b, B const* bc, C* c, const C* cc, void* v, D* d) { char* d8 = derived3(d); } +void derived4(C*); // expected-note{{candidate function not viable: cannot convert from base class pointer 'A *' to derived class pointer 'C *' for 1st argument}} + +void test_base(A* a) { + derived4(a); // expected-error{{no matching function for call to 'derived4}} +} + // Test overloading of references. // (FIXME: tests binding to determine candidate sets, not overload // resolution per se). @@ -229,6 +236,12 @@ void intref_test() { float* ir2 = intref(5.5); } +void derived5(C&); // expected-note{{candidate function not viable: cannot bind base class object of type 'A' to derived class reference 'C &' for 1st argument}} + +void test_base(A& a) { + derived5(a); // expected-error{{no matching function for call to 'derived5}} +} + // Test reference binding vs. standard conversions. int& bind_vs_conv(const double&); float& bind_vs_conv(int); @@ -460,3 +473,20 @@ namespace PR7224 { float &fr = foo(d2); } } + +namespace NontrivialSubsequence { + struct X0; + + class A { + operator X0 *(); + public: + operator const X0 *(); + }; + + A a; + void foo( void const * ); + + void g() { + foo(a); + } +} |