1*41af7c2fSPeter Collingbourne // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s 2*41af7c2fSPeter Collingbourne 3*41af7c2fSPeter Collingbourne int i __attribute__((flatten)); // expected-error {{'flatten' attribute only applies to functions}} 4*41af7c2fSPeter Collingbourne 5*41af7c2fSPeter Collingbourne void f1() __attribute__((flatten)); 6*41af7c2fSPeter Collingbourne void f2() __attribute__((flatten(1))); // expected-error {{'flatten' attribute takes no arguments}} 7*41af7c2fSPeter Collingbourne 8*41af7c2fSPeter Collingbourne template <typename T> 9*41af7c2fSPeter Collingbourne void tf1() __attribute__((flatten)); 10*41af7c2fSPeter Collingbourne 11*41af7c2fSPeter Collingbourne int f3(int __attribute__((flatten)), int); // expected-error{{'flatten' attribute only applies to functions}} 12*41af7c2fSPeter Collingbourne 13*41af7c2fSPeter Collingbourne struct A { 14*41af7c2fSPeter Collingbourne int f __attribute__((flatten)); // expected-error{{'flatten' attribute only applies to functions}} 15*41af7c2fSPeter Collingbourne void mf1() __attribute__((flatten)); 16*41af7c2fSPeter Collingbourne static void mf2() __attribute__((flatten)); 17*41af7c2fSPeter Collingbourne }; 18*41af7c2fSPeter Collingbourne 19*41af7c2fSPeter Collingbourne int ci [[gnu::flatten]]; // expected-error {{'flatten' attribute only applies to functions}} 20*41af7c2fSPeter Collingbourne 21*41af7c2fSPeter Collingbourne [[gnu::flatten]] void cf1(); 22*41af7c2fSPeter Collingbourne [[gnu::flatten(1)]] void cf2(); // expected-error {{'flatten' attribute takes no arguments}} 23*41af7c2fSPeter Collingbourne 24*41af7c2fSPeter Collingbourne template <typename T> 25*41af7c2fSPeter Collingbourne [[gnu::flatten]] 26*41af7c2fSPeter Collingbourne void ctf1(); 27*41af7c2fSPeter Collingbourne 28*41af7c2fSPeter Collingbourne int cf3(int c[[gnu::flatten]], int); // expected-error{{'flatten' attribute only applies to functions}} 29*41af7c2fSPeter Collingbourne 30*41af7c2fSPeter Collingbourne struct CA { 31*41af7c2fSPeter Collingbourne int f [[gnu::flatten]]; // expected-error{{'flatten' attribute only applies to functions}} 32*41af7c2fSPeter Collingbourne [[gnu::flatten]] void mf1(); 33*41af7c2fSPeter Collingbourne [[gnu::flatten]] static void mf2(); 34*41af7c2fSPeter Collingbourne }; 35