27 lines · cpp
1// RUN: %clang_cc1 %s -verify -fsyntax-only -triple arm-none-linux2// RUN: %clang_cc1 %s -verify -fsyntax-only -fms-compatibility -DDECLSPEC -triple i686-pc-win323 4class Foo {5 void bar();6 static void bar2();7 unsigned v;8 static unsigned s;9};10 11void __attribute__((naked)) Foo::bar() { // expected-note{{attribute is here}}12 asm("mov r2, %0" : : "r"(v)); // expected-error{{'this' pointer references not allowed in naked functions}}13}14 15void __attribute__((naked)) Foo::bar2() {16 asm("mov r2, %0" : : "r"(s)); // static member reference is OK17}18 19struct Bar {20#ifdef DECLSPEC21 __declspec(naked) void func1(); // expected-error {{'naked' attribute only applies to non-member functions}}22 __declspec(naked) static void func2(); // expected-error {{'naked' attribute only applies to non-member functions}}23#endif24 __attribute__((naked)) void func3(); // OK25 __attribute__((naked)) static void func4(); // OK26};27