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