1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify
15 template<typename T> struct RetainPtr {
16 explicit operator T*() const;
19 void methodCallToSpecific(RetainPtr<A> a) {
21 [a unknownMethod]; // expected-warning{{'A' may not respond to 'unknownMethod'}}
24 void explicitCast(RetainPtr<A> a, RetainPtr<B> b, RetainPtr<C> c) {
26 (void)(A*)b; // expected-error{{cannot convert 'RetainPtr<B>' to 'A *' without a conversion operator}}
29 (void)static_cast<A*>(a);
30 (void)static_cast<A*>(b); // expected-error{{cannot convert 'RetainPtr<B>' to 'A *' without a conversion operator}}
31 (void)static_cast<A*>(c);
34 struct Incomplete; // expected-note{{forward declaration}}
36 void methodCallToIncomplete(Incomplete &incomplete) {
37 [incomplete knownMethod]; // expected-error{{incomplete receiver type 'Incomplete'}}
41 explicit operator id() const;
44 void methodCallToId(IdPtr a) {
49 void explicitCast(IdPtr a) {
51 (void)static_cast<A*>(a);