summaryrefslogtreecommitdiff
path: root/clang/test/CXX/expr/expr.mptr.oper/p5.cpp
blob: 7380b5d4805d6fdb5bb24ccb6fbe44599af4f4d7 (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
// RUN: %clang_cc1 -fsyntax-only -verify %s

struct X0 {
  void f0();
  void f1() const;
  void f2() volatile;
  void f3() const volatile;
};

void test_object_cvquals(void (X0::*pm)(),
                         void (X0::*pmc)() const,
                         void (X0::*pmv)() volatile,
                         void (X0::*pmcv)() const volatile,
                         X0 *p,
                         const X0 *pc,
                         volatile X0 *pv,
                         const volatile X0 *pcv,
                         X0 &o,
                         const X0 &oc,
                         volatile X0 &ov,
                         const volatile X0 &ocv) {
  (p->*pm)();
  (p->*pmc)();
  (p->*pmv)();
  (p->*pmcv)();

  (pc->*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'const' qualifier}}
  (pc->*pmc)();
  (pc->*pmv)(); // expected-error{{call to pointer to member function of type 'void () volatile' drops 'const' qualifier}}
  (pc->*pmcv)();

  (pv->*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'volatile' qualifier}}
  (pv->*pmc)(); // expected-error{{call to pointer to member function of type 'void () const' drops 'volatile' qualifier}}
  (pv->*pmv)();
  (pv->*pmcv)();

  (pcv->*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'const volatile' qualifiers}}
  (pcv->*pmc)(); // expected-error{{call to pointer to member function of type 'void () const' drops 'volatile' qualifier}}
  (pcv->*pmv)(); // expected-error{{call to pointer to member function of type 'void () volatile' drops 'const' qualifier}}
  (pcv->*pmcv)();

  (o.*pm)();
  (o.*pmc)();
  (o.*pmv)();
  (o.*pmcv)();

  (oc.*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'const' qualifier}}
  (oc.*pmc)();
  (oc.*pmv)(); // expected-error{{call to pointer to member function of type 'void () volatile' drops 'const' qualifier}}
  (oc.*pmcv)();

  (ov.*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'volatile' qualifier}}
  (ov.*pmc)(); // expected-error{{call to pointer to member function of type 'void () const' drops 'volatile' qualifier}}
  (ov.*pmv)();
  (ov.*pmcv)();

  (ocv.*pm)(); // expected-error{{call to pointer to member function of type 'void ()' drops 'const volatile' qualifiers}}
  (ocv.*pmc)(); // expected-error{{call to pointer to member function of type 'void () const' drops 'volatile' qualifier}}
  (ocv.*pmv)(); // expected-error{{call to pointer to member function of type 'void () volatile' drops 'const' qualifier}}
  (ocv.*pmcv)();
}