File: p13.cpp

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,418,840 kB
  • sloc: cpp: 5,290,826; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,898; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,913; xml: 953; cs: 573; fortran: 539
file content (77 lines) | stat: -rw-r--r-- 1,821 bytes parent folder | download | duplicates (38)
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
77
// RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics

// 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