diff options
Diffstat (limited to 'test/SemaCXX/decl-microsoft-call-conv.cpp')
-rw-r--r-- | test/SemaCXX/decl-microsoft-call-conv.cpp | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/test/SemaCXX/decl-microsoft-call-conv.cpp b/test/SemaCXX/decl-microsoft-call-conv.cpp index 9f1463245ba2..eb6c8507eddc 100644 --- a/test/SemaCXX/decl-microsoft-call-conv.cpp +++ b/test/SemaCXX/decl-microsoft-call-conv.cpp @@ -1,4 +1,6 @@ -// RUN: %clang_cc1 -triple i686-pc-win32 -cxx-abi microsoft -fms-extensions -verify %s +// RUN: %clang_cc1 -triple i686-pc-win32 -fms-extensions -verify %s +// RUN: %clang_cc1 -triple i686-pc-mingw32 -verify %s +// RUN: %clang_cc1 -triple i686-pc-mingw32 -fms-extensions -verify %s typedef void void_fun_t(); typedef void __cdecl cdecl_fun_t(); @@ -191,3 +193,41 @@ namespace test5 { }; extern template void valarray<int>::bar(); } + +namespace test6 { + struct foo { + int bar(); + }; + typedef int bar_t(); + void zed(bar_t foo::*) { + } + void baz() { + zed(&foo::bar); + } +} + +namespace test7 { + template <typename T> + struct S { + void f(T t) { + t = 42; + } + }; + template<> void S<void*>::f(void*); + void g(S<void*> s, void* p) { + s.f(p); + } +} + +namespace test8 { + template <typename T> + struct S { + void f(T t) { // expected-note {{previous declaration is here}} + t = 42; // expected-error {{assigning to 'void *' from incompatible type 'int'}} + } + }; + template<> void __cdecl S<void*>::f(void*); // expected-error {{function declared 'cdecl' here was previously declared without calling convention}} + void g(S<void*> s, void* p) { + s.f(p); // expected-note {{in instantiation of member function 'test8::S<void *>::f' requested here}} + } +} |