1 // RUN: %clang_cc1 -triple i686-pc-win32 -cxx-abi microsoft -fms-extensions -verify %s
3 // Pointers to free functions
4 void free_func_default();
5 void __cdecl free_func_cdecl();
6 void __stdcall free_func_stdcall(); // expected-note {{previous declaration is here}}
7 void __fastcall free_func_fastcall(); // expected-note 2 {{previous declaration is here}}
9 void __cdecl free_func_default(); // expected-note 2 {{previous declaration is here}}
10 void __stdcall free_func_default(); // expected-error {{function declared 'stdcall' here was previously declared without calling convention}}
11 void __fastcall free_func_default(); // expected-error {{function declared 'fastcall' here was previously declared without calling convention}}
13 void free_func_cdecl(); // expected-note 2 {{previous declaration is here}}
14 void __stdcall free_func_cdecl(); // expected-error {{function declared 'stdcall' here was previously declared 'cdecl'}}
15 void __fastcall free_func_cdecl(); // expected-error {{function declared 'fastcall' here was previously declared 'cdecl'}}
17 void __cdecl free_func_stdcall(); // expected-error {{function declared 'cdecl' here was previously declared 'stdcall'}}
18 void free_func_stdcall(); // expected-note {{previous declaration is here}}
19 void __fastcall free_func_stdcall(); // expected-error {{function declared 'fastcall' here was previously declared 'stdcall'}}
21 void __cdecl free_func_fastcall(); // expected-error {{function declared 'cdecl' here was previously declared 'fastcall'}}
22 void __stdcall free_func_fastcall(); // expected-error {{function declared 'stdcall' here was previously declared 'fastcall'}}
23 void free_func_fastcall();
25 // Overloaded functions may have different calling conventions
26 void __fastcall free_func_default(int);
27 void __cdecl free_func_default(int *);
29 void __thiscall free_func_cdecl(char *);
30 void __cdecl free_func_cdecl(double);
33 // Pointers to member functions
35 void member_default1(); // expected-note {{previous declaration is here}}
36 void member_default2();
37 void __cdecl member_cdecl1();
38 void __cdecl member_cdecl2(); // expected-note {{previous declaration is here}}
39 void __thiscall member_thiscall1();
40 void __thiscall member_thiscall2(); // expected-note {{previous declaration is here}}
42 // Static member functions can't be __thiscall
43 static void static_member_default1();
44 static void static_member_default2(); // expected-note {{previous declaration is here}}
45 static void __cdecl static_member_cdecl1();
46 static void __cdecl static_member_cdecl2(); // expected-note {{previous declaration is here}}
47 static void __stdcall static_member_stdcall1();
48 static void __stdcall static_member_stdcall2();
50 // Variadic functions can't be other than default or __cdecl
51 void member_variadic_default(int x, ...);
52 void __cdecl member_variadic_cdecl(int x, ...);
54 static void static_member_variadic_default(int x, ...);
55 static void __cdecl static_member_variadic_cdecl(int x, ...);
58 void __cdecl S::member_default1() {} // expected-error {{function declared 'cdecl' here was previously declared without calling convention}}
59 void __thiscall S::member_default2() {}
61 void S::member_cdecl1() {}
62 void __thiscall S::member_cdecl2() {} // expected-error {{function declared 'thiscall' here was previously declared 'cdecl'}}
64 void S::member_thiscall1() {}
65 void __cdecl S::member_thiscall2() {} // expected-error {{function declared 'cdecl' here was previously declared 'thiscall'}}
67 void __cdecl S::static_member_default1() {}
68 void __stdcall S::static_member_default2() {} // expected-error {{function declared 'stdcall' here was previously declared without calling convention}}
70 void S::static_member_cdecl1() {}
71 void __stdcall S::static_member_cdecl2() {} // expected-error {{function declared 'stdcall' here was previously declared 'cdecl'}}
73 void __cdecl S::member_variadic_default(int x, ...) {
76 void S::member_variadic_cdecl(int x, ...) {
80 void __cdecl S::static_member_variadic_default(int x, ...) {
83 void S::static_member_variadic_cdecl(int x, ...) {