1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify %s
2*67e74705SXin Li
3*67e74705SXin Li struct X0 {
4*67e74705SXin Li void f0();
5*67e74705SXin Li void f1() const;
6*67e74705SXin Li void f2() volatile;
7*67e74705SXin Li void f3() const volatile;
8*67e74705SXin Li };
9*67e74705SXin Li
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)10*67e74705SXin Li void test_object_cvquals(void (X0::*pm)(),
11*67e74705SXin Li void (X0::*pmc)() const,
12*67e74705SXin Li void (X0::*pmv)() volatile,
13*67e74705SXin Li void (X0::*pmcv)() const volatile,
14*67e74705SXin Li X0 *p,
15*67e74705SXin Li const X0 *pc,
16*67e74705SXin Li volatile X0 *pv,
17*67e74705SXin Li const volatile X0 *pcv,
18*67e74705SXin Li X0 &o,
19*67e74705SXin Li const X0 &oc,
20*67e74705SXin Li volatile X0 &ov,
21*67e74705SXin Li const volatile X0 &ocv) {
22*67e74705SXin Li (p->*pm)();
23*67e74705SXin Li (p->*pmc)();
24*67e74705SXin Li (p->*pmv)();
25*67e74705SXin Li (p->*pmcv)();
26*67e74705SXin Li
27*67e74705SXin Li (pc->*pm)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}}' drops 'const' qualifier}}
28*67e74705SXin Li (pc->*pmc)();
29*67e74705SXin Li (pc->*pmv)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}} volatile' drops 'const' qualifier}}
30*67e74705SXin Li (pc->*pmcv)();
31*67e74705SXin Li
32*67e74705SXin Li (pv->*pm)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}}' drops 'volatile' qualifier}}
33*67e74705SXin Li (pv->*pmc)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}} const' drops 'volatile' qualifier}}
34*67e74705SXin Li (pv->*pmv)();
35*67e74705SXin Li (pv->*pmcv)();
36*67e74705SXin Li
37*67e74705SXin Li (pcv->*pm)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}}' drops 'const volatile' qualifiers}}
38*67e74705SXin Li (pcv->*pmc)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}} const' drops 'volatile' qualifier}}
39*67e74705SXin Li (pcv->*pmv)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}} volatile' drops 'const' qualifier}}
40*67e74705SXin Li (pcv->*pmcv)();
41*67e74705SXin Li
42*67e74705SXin Li (o.*pm)();
43*67e74705SXin Li (o.*pmc)();
44*67e74705SXin Li (o.*pmv)();
45*67e74705SXin Li (o.*pmcv)();
46*67e74705SXin Li
47*67e74705SXin Li (oc.*pm)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}}' drops 'const' qualifier}}
48*67e74705SXin Li (oc.*pmc)();
49*67e74705SXin Li (oc.*pmv)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}} volatile' drops 'const' qualifier}}
50*67e74705SXin Li (oc.*pmcv)();
51*67e74705SXin Li
52*67e74705SXin Li (ov.*pm)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}}' drops 'volatile' qualifier}}
53*67e74705SXin Li (ov.*pmc)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}} const' drops 'volatile' qualifier}}
54*67e74705SXin Li (ov.*pmv)();
55*67e74705SXin Li (ov.*pmcv)();
56*67e74705SXin Li
57*67e74705SXin Li (ocv.*pm)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}}' drops 'const volatile' qualifiers}}
58*67e74705SXin Li (ocv.*pmc)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}} const' drops 'volatile' qualifier}}
59*67e74705SXin Li (ocv.*pmv)(); // expected-error-re{{call to pointer to member function of type 'void (){{( __attribute__\(\(thiscall\)\))?}} volatile' drops 'const' qualifier}}
60*67e74705SXin Li (ocv.*pmcv)();
61*67e74705SXin Li }
62