// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
// RUN: %clang_cc1 -std=c++98 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
// RUN: %clang_cc1 -std=c++11 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fms-extensions -fexceptions -fcxx-exceptions -DTEST1
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wmicrosoft -Wc++11-extensions -Wno-long-long -verify -fexceptions -fcxx-exceptions -DTEST2
// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -std=c++11 -fms-compatibility -verify -DTEST3
// MSVC allows type definition in anonymous union and struct
;
// __stdcall handling
;
// __unaligned handling
typedef char __unaligned *aligned_type;
typedef struct UnalignedTag __unaligned *aligned_type2;
typedef char __unaligned aligned_type3;
;
__unaligned int aligned_type4::*p1_aligned_type4 = &aligned_type4::i;
int aligned_type4::* __unaligned p2_aligned_type4 = &aligned_type4::i;
__unaligned int aligned_type4::* __unaligned p3_aligned_type4 = &aligned_type4::i;
void ;
// Check that __unaligned qualifier can be used for overloading
void
void
void // expected-note {{previous definition is here}}
void // expected-error {{redefinition of 'foo_unaligned'}}
;
;
int
void *
void
// Test from PR27367
// We should accept assignment of an __unaligned pointer to a non-__unaligned
// pointer to void
typedef struct _ITEMIDLIST ITEMIDLIST;
typedef ITEMIDLIST __unaligned *LPITEMIDLIST;
extern "C" __declspec void __stdcall ;
__inline void
// Test from PR27666
// We should accept type conversion of __unaligned to non-__unaligned references
typedef struct in_addr IN_ADDR;
void
void
void
// Enumeration types with a fixed underlying type.
const int seventeen = 17;
typedef int Int;
;
// expected-warning@+2 {{enumeration types with a fixed underlying type are a C++11 extension}}
;
;
__declspec void
;
void // expected-warning {{redefinition of default argument}}
extern void ;
void ; // expected-note {{previous declaration is here}}
static void
extern const int static_var; // expected-note {{previous declaration is here}}
static const int static_var = 3; // expected-warning {{redeclaring non-static 'static_var' as static is a Microsoft extension}}
void
void
;
void
; // expected-warning{{extra qualification on member 'f'}}
;
;
void
/* 4 tests for PseudoObject, begin */
;
;
void
;
;
void
;
;
void
/* 4 tests for PseudoObject, end */
// Property access: explicit, implicit, with Qualifier
;
;
// Property usage
;
;
void
;
// Property getter using reference.
;
void
;
;
int *
int MSPropertyClass::*
// expected-error@+1 {{'sealed' keyword not permitted with interface types}}
__interface InterfaceWithSealed sealed ;
;
// expected-note@+2 {{'SealedType' declared here}}
// expected-warning@+1 {{'sealed' keyword is a Microsoft extension}}
;
// expected-error@+1 {{base 'SealedType' is marked 'sealed'}}
;
;
// expected-warning@+1 {{'abstract' keyword is a Microsoft extension}}
;
// expected-error@+1 {{variable type 'AbstractClass' is an abstract class}}
AbstractClass abstractInstance;
// expected-warning@+4 {{abstract class is marked 'sealed'}}
// expected-note@+3 {{'AbstractAndSealedClass' declared here}}
// expected-warning@+2 {{'abstract' keyword is a Microsoft extension}}
// expected-warning@+1 {{'sealed' keyword is a Microsoft extension}}
; // Does no really make sense, but allowed
// expected-error@+1 {{variable type 'AbstractAndSealedClass' is an abstract class}}
AbstractAndSealedClass abstractAndSealedInstance;
// expected-error@+1 {{base 'AbstractAndSealedClass' is marked 'sealed'}}
;
// expected-warning@+4 {{'final' keyword is a C++11 extension}}
// expected-warning@+3 {{'final' keyword is a C++11 extension}}
// expected-error@+1 {{class already marked 'final'}}
;
// expected-warning@+4 {{'final' keyword is a C++11 extension}}
// expected-warning@+2 {{'sealed' keyword is a Microsoft extension}}
// expected-error@+1 {{class already marked 'sealed'}}
;
// expected-warning@+6 {{'final' keyword is a C++11 extension}}
// expected-warning@+5 {{'final' keyword is a C++11 extension}}
// expected-warning@+3 {{abstract class is marked 'final'}}
// expected-warning@+2 {{'abstract' keyword is a Microsoft extension}}
// expected-error@+1 {{class already marked 'final'}}
;
// expected-warning@+6 {{'final' keyword is a C++11 extension}}
// expected-warning@+4 {{abstract class is marked 'final'}}
// expected-warning@+3 {{'abstract' keyword is a Microsoft extension}}
// expected-warning@+2 {{'abstract' keyword is a Microsoft extension}}
// expected-error@+1 {{class already marked 'abstract'}}
;
;
;
// expected-error@+1 {{variable type 'AbstractFunctionInClass' is an abstract class}}
AbstractFunctionInClass abstractFunctionInClassInstance;
void
;
void operator delete throw;
// expected-note@-1 {{previous declaration is here}}
__declspec void operator delete throw;
// expected-error@-1 {{redeclaration of 'operator delete' cannot add 'dllexport' attribute}}
void
// Check that __unaligned is not recognized if MS extensions are not enabled
typedef char __unaligned *aligned_type; // expected-error {{expected ';' after top level declarator}}