1 // RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wmicrosoft -verify -fms-extensions
8 void test_if_exists_stmts() {
10 __if_exists(MayExist::Type
) {
14 __if_exists(MayExist::Type_not
) {
15 this will
not compile
.
17 __if_not_exists(MayExist::Type
) {
18 this will
not compile
.
20 __if_not_exists(MayExist::Type_not
) {
26 int if_exists_creates_no_scope() {
27 __if_exists(MayExist::Type
) {
28 int x
; // 'x' is declared in the parent scope.
30 __if_not_exists(MayExist::Type_not
) {
36 __if_exists(MayExist::Type
) {
40 __if_exists(MayExist::Type_not
) {
41 this will
not compile
.
44 __if_not_exists(MayExist::Type
) {
45 this will
not compile
.
48 __if_not_exists(MayExist::Type_not
) {
52 void test_if_exists_init_list() {
56 __if_exists(MayExist::Type
) {2, }
62 __if_exists(MayExist::Type_not
) { this will
not compile
}
68 __if_not_exists(MayExist::Type_not
) {2, }
74 __if_not_exists(MayExist::Type
) { this will
not compile
}
81 class IfExistsClassScope
{
82 __if_exists(MayExist::Type
) {
83 // __if_exists, __if_not_exists can nest
84 __if_not_exists(MayExist::Type_not
) {
90 __if_exists(MayExist::Type_not
) {
91 this will
not compile
.
94 __if_not_exists(MayExist::Type
) {
95 this will
not compile
.
98 __if_not_exists(MayExist::Type_not
) {
103 void test_nested_if_exists() {
104 __if_exists(MayExist::Type
) {
106 __if_not_exists(MayExist::Type_not
) {
112 void test_attribute_on_if_exists() {
113 [[clang::fallthrough
]] // expected-error {{an attribute list cannot appear here}}
114 __if_exists(MayExist::Type
) {