xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/qualification-conversion.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
2*f4a2713aSLionel Sambuc int* quals1(int const * p);
3*f4a2713aSLionel Sambuc int* quals2(int const * const * pp);
4*f4a2713aSLionel Sambuc int* quals3(int const * * const * ppp); // expected-note{{candidate function}}
5*f4a2713aSLionel Sambuc 
test_quals(int * p,int ** pp,int *** ppp)6*f4a2713aSLionel Sambuc void test_quals(int * p, int * * pp, int * * * ppp) {
7*f4a2713aSLionel Sambuc   int const * const * pp2 = pp;
8*f4a2713aSLionel Sambuc   quals1(p);
9*f4a2713aSLionel Sambuc   quals2(pp);
10*f4a2713aSLionel Sambuc   quals3(ppp); // expected-error {{no matching}}
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc struct A {};
14*f4a2713aSLionel Sambuc void mquals1(int const A::*p);
15*f4a2713aSLionel Sambuc void mquals2(int const A::* const A::*pp);
16*f4a2713aSLionel Sambuc void mquals3(int const A::* A::* const A::*ppp);  // expected-note{{candidate function}}
17*f4a2713aSLionel Sambuc 
test_mquals(int A::* p,int A::* A::* pp,int A::* A::* A::* ppp)18*f4a2713aSLionel Sambuc void test_mquals(int A::*p, int A::* A::*pp, int A::* A::* A::*ppp) {
19*f4a2713aSLionel Sambuc   int const A::* const A::* pp2 = pp;
20*f4a2713aSLionel Sambuc   mquals1(p);
21*f4a2713aSLionel Sambuc   mquals2(pp);
22*f4a2713aSLionel Sambuc   mquals3(ppp); // expected-error {{no matching}}
23*f4a2713aSLionel Sambuc }
24*f4a2713aSLionel Sambuc 
25*f4a2713aSLionel Sambuc void aquals1(int const (*p)[1]);
26*f4a2713aSLionel Sambuc void aquals2(int * const (*pp)[1]);
27*f4a2713aSLionel Sambuc void aquals2a(int const * (*pp2)[1]); // expected-note{{candidate function}}
28*f4a2713aSLionel Sambuc 
test_aquals(int (* p)[1],int * (* pp)[1],int * (* pp2)[1])29*f4a2713aSLionel Sambuc void test_aquals(int (*p)[1], int * (*pp)[1], int * (*pp2)[1]) {
30*f4a2713aSLionel Sambuc   int const (*p2)[1] = p;
31*f4a2713aSLionel Sambuc   aquals1(p);
32*f4a2713aSLionel Sambuc   aquals2(pp);
33*f4a2713aSLionel Sambuc   aquals2a(pp2); // expected-error {{no matching}}
34*f4a2713aSLionel Sambuc }
35