54 lines · c
1// RUN: %clang_cc1 -fsyntax-only -fms-extensions -verify -triple i686-pc-win32 %s2// RUN: %clang_cc1 -fsyntax-only -fms-extensions -verify -triple x86_64-pc-win32 %s3// RUN: %clang_cc1 -x c++ -fsyntax-only -fms-extensions -verify -triple i686-pc-win32 %s4// RUN: %clang_cc1 -x c++ -DEXTERN_C='extern "C"' -fsyntax-only -fms-extensions -verify -triple i686-pc-win32 %s5 6#ifndef EXTERN_C7#define EXTERN_C8#if defined(__cplusplus)9#define EXPECT_NODIAG10// expected-no-diagnostics11#endif12#endif13 14#ifndef EXPECT_NODIAG15// expected-note-re@+2 1+ {{forward declaration of '{{(struct )?}}Foo'}}16#endif17struct Foo;18 19EXTERN_C void __stdcall fwd_std(struct Foo p);20#if !defined(EXPECT_NODIAG) && defined(_M_IX86)21// expected-error@+2 {{parameter 'p' must have a complete type to use function 'fwd_std' with the stdcall calling convention}}22#endif23void (__stdcall *fp_fwd_std)(struct Foo) = &fwd_std;24 25EXTERN_C void __fastcall fwd_fast(struct Foo p);26#if !defined(EXPECT_NODIAG) && defined(_M_IX86)27// expected-error@+2 {{parameter 'p' must have a complete type to use function 'fwd_fast' with the fastcall calling convention}}28#endif29void (__fastcall *fp_fwd_fast)(struct Foo) = &fwd_fast;30 31EXTERN_C void __vectorcall fwd_vector(struct Foo p);32#if !defined(EXPECT_NODIAG)33// expected-error@+2 {{parameter 'p' must have a complete type to use function 'fwd_vector' with the vectorcall calling convention}}34#endif35void (__vectorcall *fp_fwd_vector)(struct Foo) = &fwd_vector;36 37#if defined(__cplusplus)38template <typename T> struct TemplateWrapper {39#ifndef EXPECT_NODIAG40 // expected-error@+2 {{field has incomplete type 'Foo'}}41#endif42 T field;43};44 45EXTERN_C void __vectorcall tpl_ok(TemplateWrapper<int> p);46void(__vectorcall *fp_tpl_ok)(TemplateWrapper<int>) = &tpl_ok;47 48EXTERN_C void __vectorcall tpl_fast(TemplateWrapper<Foo> p);49#ifndef EXPECT_NODIAG50// expected-note@+2 {{requested here}}51#endif52void(__vectorcall *fp_tpl_fast)(TemplateWrapper<Foo>) = &tpl_fast;53#endif54