78 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2// expected-no-diagnostics3 4// C++03 [namespace.udecl]p3:5// For the purpose of overload resolution, the functions which are6// introduced by a using-declaration into a derived class will be7// treated as though they were members of the derived class. In8// particular, the implicit this parameter shall be treated as if it9// were a pointer to the derived class rather than to the base10// class. This has no effect on the type of the function, and in all11// other respects the function remains a member of the base class.12 13namespace test0 {14 struct Opaque0 {};15 struct Opaque1 {};16 17 struct Base {18 Opaque0 test0(int*);19 Opaque0 test1(const int*);20 Opaque0 test2(int*);21 Opaque0 test3(int*) const;22 };23 24 struct Derived : Base {25 using Base::test0;26 Opaque1 test0(const int*);27 28 using Base::test1;29 Opaque1 test1(int*);30 31 using Base::test2;32 Opaque1 test2(int*) const;33 34 using Base::test3;35 Opaque1 test3(int*);36 };37 38 void test0() {39 Opaque0 a = Derived().test0((int*) 0);40 Opaque1 b = Derived().test0((const int*) 0);41 }42 43 void test1() {44 Opaque1 a = Derived().test1((int*) 0);45 Opaque0 b = Derived().test1((const int*) 0);46 }47 48 void test2() {49 Opaque0 a = ((Derived*) 0)->test2((int*) 0);50 Opaque1 b = ((const Derived*) 0)->test2((int*) 0);51 }52 53 void test3() {54 Opaque1 a = ((Derived*) 0)->test3((int*) 0);55 Opaque0 b = ((const Derived*) 0)->test3((int*) 0);56 }57}58 59// Typedef redeclaration.60namespace rdar8018262 {61 typedef void (*fp)();62 63 namespace N {64 typedef void (*fp)();65 }66 67 using N::fp;68 69 fp fp_1;70}71 72// Things to test:73// member operators74// conversion operators75// call operators76// call-surrogate conversion operators77// everything, but in dependent contexts78