xref: /aosp_15_r20/external/clang/test/SemaCXX/attr-cleanup-gcc.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 %s -verify -fsyntax-only -Wgcc-compat
2*67e74705SXin Li 
3*67e74705SXin Li namespace N {
c1(int * a)4*67e74705SXin Li   void c1(int *a) {}
5*67e74705SXin Li }
6*67e74705SXin Li 
c2(int * a)7*67e74705SXin Li void c2(int *a) {}
8*67e74705SXin Li 
9*67e74705SXin Li template <typename Ty>
c3(Ty * a)10*67e74705SXin Li void c3(Ty *a) {}
11*67e74705SXin Li 
t3()12*67e74705SXin Li void t3() {
13*67e74705SXin Li   int v1 __attribute__((cleanup(N::c1)));  // expected-warning  {{GCC does not allow the 'cleanup' attribute argument to be anything other than a simple identifier}}
14*67e74705SXin Li   int v2 __attribute__((cleanup(c2)));
15*67e74705SXin Li   int v3 __attribute__((cleanup(c3<int>)));  // expected-warning  {{GCC does not allow the 'cleanup' attribute argument to be anything other than a simple identifier}}
16*67e74705SXin Li }
17