summaryrefslogtreecommitdiff
path: root/clang/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p13.cpp
blob: dd44bfc914b2d55d6ea900d5b483a81702385b87 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// RUN: %clang_cc1 -fsyntax-only -verify %s

// C++03 [namespace.udecl]p3:
//   For the purpose of overload resolution, the functions which are
//   introduced by a using-declaration into a derived class will be
//   treated as though they were members of the derived class. In
//   particular, the implicit this parameter shall be treated as if it
//   were a pointer to the derived class rather than to the base
//   class. This has no effect on the type of the function, and in all
//   other respects the function remains a member of the base class.

namespace test0 {
  struct Opaque0 {};
  struct Opaque1 {};

  struct Base {
    Opaque0 test0(int*);
    Opaque0 test1(const int*);
    Opaque0 test2(int*);
    Opaque0 test3(int*) const;
  };

  struct Derived : Base {
    using Base::test0;
    Opaque1 test0(const int*);

    using Base::test1;
    Opaque1 test1(int*);

    using Base::test2;
    Opaque1 test2(int*) const;

    using Base::test3;
    Opaque1 test3(int*);
  };

  void test0() {
    Opaque0 a = Derived().test0((int*) 0);
    Opaque1 b = Derived().test0((const int*) 0);
  }

  void test1() {
    Opaque1 a = Derived().test1((int*) 0);
    Opaque0 b = Derived().test1((const int*) 0);
  }

  void test2() {
    Opaque0 a = ((Derived*) 0)->test2((int*) 0);
    Opaque1 b = ((const Derived*) 0)->test2((int*) 0);
  }

  void test3() {
    Opaque1 a = ((Derived*) 0)->test3((int*) 0);
    Opaque0 b = ((const Derived*) 0)->test3((int*) 0);
  }
}

// Typedef redeclaration.
namespace rdar8018262 {
  typedef void (*fp)();

  namespace N {
    typedef void (*fp)();
  }

  using N::fp;

  fp fp_1;
}

// Things to test:
//   member operators
//   conversion operators
//   call operators
//   call-surrogate conversion operators
//   everything, but in dependent contexts