xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/attr-cleanup.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -verify -fsyntax-only -Wno-gcc-compat
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc namespace N {
c1(int * a)4*f4a2713aSLionel Sambuc   void c1(int *a) {}
5*f4a2713aSLionel Sambuc }
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc class C {
c2(int * a)8*f4a2713aSLionel Sambuc   static void c2(int *a) {}  // expected-note {{implicitly declared private here}} expected-note {{implicitly declared private here}}
9*f4a2713aSLionel Sambuc };
10*f4a2713aSLionel Sambuc 
t1()11*f4a2713aSLionel Sambuc void t1() {
12*f4a2713aSLionel Sambuc   int v1 __attribute__((cleanup(N::c1)));
13*f4a2713aSLionel Sambuc   int v2 __attribute__((cleanup(N::c2)));  // expected-error {{no member named 'c2' in namespace 'N'}}
14*f4a2713aSLionel Sambuc   int v3 __attribute__((cleanup(C::c2)));  // expected-error {{'c2' is a private member of 'C'}}
15*f4a2713aSLionel Sambuc }
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc class D : public C {
t2()18*f4a2713aSLionel Sambuc   void t2() {
19*f4a2713aSLionel Sambuc     int v1 __attribute__((cleanup(c2)));  // expected-error {{'c2' is a private member of 'C'}}
20*f4a2713aSLionel Sambuc   }
21*f4a2713aSLionel Sambuc };
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc namespace E {
c3(int * a)24*f4a2713aSLionel Sambuc   void c3(int *a) {} // expected-note {{candidate function}}
c3()25*f4a2713aSLionel Sambuc   void c3() {}       // expected-note {{candidate function}}
t3()26*f4a2713aSLionel Sambuc   void t3() {
27*f4a2713aSLionel Sambuc     int v1 __attribute__((cleanup(c3))); // expected-error {{'c3' is not a single function}}
28*f4a2713aSLionel Sambuc   }
29*f4a2713aSLionel Sambuc }
30