在 2020/2/5 下午5:52, Jonathan Wakely 写道: > > I think that's correct. The attribute grammar is confusing, but it > does apply to the return type as used above, and that's obviously > meaningless since 'int' has no calling convention. > But this error only occurs when declaring a pointer-to-member-function using the `typedef` declaration, not a using-declaration: ```c++ class Z; int main() { extern int __attribute__((__stdcall__)) A(void); __attribute__((__stdcall__)) extern int A(void); extern int A(void) __attribute__((__stdcall__)); // ok typedef int __attribute__((__stdcall__)) (*B)(void); typedef __attribute__((__stdcall__)) int (*B)(void); typedef int (*B)(void) __attribute__((__stdcall__)); // ok typedef int __attribute__((__fastcall__)) (*C)(void); typedef __attribute__((__fastcall__)) int (*C)(void); typedef int (*C)(void) __attribute__((__fastcall__)); // ok typedef int __attribute__((__stdcall__)) (Z::*D)(void); typedef __attribute__((__stdcall__)) int (Z::*D)(void); typedef int (Z::*D)(void) __attribute__((__stdcall__)); // ok typedef int __attribute__((__fastcall__)) (Z::*E)(void); typedef __attribute__((__fastcall__)) int (Z::*E)(void); typedef int (Z::*E)(void) __attribute__((__fastcall__)); // error } ``` ``` lh_mouse@lhmouse-ideapad ~/Desktop $ i686-w64-mingw32-g++ test.c test.c: In function ‘int main()’: test.c:20:57: error: fastcall and stdcall attributes are not compatible typedef int __attribute__((__fastcall__)) (Z::*E)(void); ^ test.c:21:57: error: fastcall and stdcall attributes are not compatible typedef __attribute__((__fastcall__)) int (Z::*E)(void); ^ test.c:22:57: error: fastcall and stdcall attributes are not compatible typedef int (Z::*E)(void) __attribute__((__fastcall__)); ^ ``` -- Best regards, LH_Mouse