xref: /minix3/external/bsd/llvm/dist/clang/test/Parser/cxx-attributes.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2f4a2713aSLionel Sambuc 
3f4a2713aSLionel Sambuc class c {
4f4a2713aSLionel Sambuc   virtual void f1(const char* a, ...)
5f4a2713aSLionel Sambuc     __attribute__ (( __format__(__printf__,2,3) )) = 0;
f2(const char * a,...)6f4a2713aSLionel Sambuc   virtual void f2(const char* a, ...)
7f4a2713aSLionel Sambuc     __attribute__ (( __format__(__printf__,2,3) )) {}
8f4a2713aSLionel Sambuc };
9f4a2713aSLionel Sambuc 
10f4a2713aSLionel Sambuc template <typename T> class X {
11f4a2713aSLionel Sambuc   template <typename S> void X<S>::f() __attribute__((locks_excluded())); // expected-error{{nested name specifier 'X<S>::' for declaration does not refer into a class, class template or class template partial specialization}} \
12f4a2713aSLionel Sambuc                                                                           // expected-warning{{attribute locks_excluded ignored, because it is not attached to a declaration}}
13f4a2713aSLionel Sambuc };
14f4a2713aSLionel Sambuc 
15f4a2713aSLionel Sambuc namespace PR17666 {
16f4a2713aSLionel Sambuc   const int A = 1;
17f4a2713aSLionel Sambuc   typedef int __attribute__((__aligned__(A))) T1;
18f4a2713aSLionel Sambuc   int check1[__alignof__(T1) == 1 ? 1 : -1];
19f4a2713aSLionel Sambuc 
20f4a2713aSLionel Sambuc   typedef int __attribute__((aligned(int(1)))) T1;
21f4a2713aSLionel Sambuc   typedef int __attribute__((aligned(int))) T2; // expected-error {{expected '(' for function-style cast}}
22f4a2713aSLionel Sambuc }
23*0a6a1f1dSLionel Sambuc 
24*0a6a1f1dSLionel Sambuc __attribute((typename)) int x; // expected-warning {{unknown attribute 'typename' ignored}}
25