[bazel] Port 0aa831e0edb1c1deabb96ce2435667cc82bac79b
[llvm-project.git] / clang / test / CXX / dcl.dcl / basic.namespace / namespace.udecl / p13.cpp
blob699d80ae7c7f48e51cf9dd7b641aa88977940393
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 // C++03 [namespace.udecl]p3:
5 // For the purpose of overload resolution, the functions which are
6 // introduced by a using-declaration into a derived class will be
7 // treated as though they were members of the derived class. In
8 // particular, the implicit this parameter shall be treated as if it
9 // were a pointer to the derived class rather than to the base
10 // class. This has no effect on the type of the function, and in all
11 // other respects the function remains a member of the base class.
13 namespace test0 {
14 struct Opaque0 {};
15 struct Opaque1 {};
17 struct Base {
18 Opaque0 test0(int*);
19 Opaque0 test1(const int*);
20 Opaque0 test2(int*);
21 Opaque0 test3(int*) const;
24 struct Derived : Base {
25 using Base::test0;
26 Opaque1 test0(const int*);
28 using Base::test1;
29 Opaque1 test1(int*);
31 using Base::test2;
32 Opaque1 test2(int*) const;
34 using Base::test3;
35 Opaque1 test3(int*);
38 void test0() {
39 Opaque0 a = Derived().test0((int*) 0);
40 Opaque1 b = Derived().test0((const int*) 0);
43 void test1() {
44 Opaque1 a = Derived().test1((int*) 0);
45 Opaque0 b = Derived().test1((const int*) 0);
48 void test2() {
49 Opaque0 a = ((Derived*) 0)->test2((int*) 0);
50 Opaque1 b = ((const Derived*) 0)->test2((int*) 0);
53 void test3() {
54 Opaque1 a = ((Derived*) 0)->test3((int*) 0);
55 Opaque0 b = ((const Derived*) 0)->test3((int*) 0);
59 // Typedef redeclaration.
60 namespace rdar8018262 {
61 typedef void (*fp)();
63 namespace N {
64 typedef void (*fp)();
67 using N::fp;
69 fp fp_1;
72 // Things to test:
73 // member operators
74 // conversion operators
75 // call operators
76 // call-surrogate conversion operators
77 // everything, but in dependent contexts