From: Reid Kleckner Date: Wed, 25 Jun 2014 00:10:50 +0000 (+0000) Subject: Add a missing test for the __if_exists extension X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=450955db5aa414877c6c966660b41472ffd60b52;p=clang Add a missing test for the __if_exists extension MSVC does not create a new scope for the body of an __if_exists compound statement. Clang already gets this right today, but it was untested. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211650 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Parser/ms-if-exists.cpp b/test/Parser/ms-if-exists.cpp index f1cfbcfdfe..2d4a957f12 100644 --- a/test/Parser/ms-if-exists.cpp +++ b/test/Parser/ms-if-exists.cpp @@ -25,6 +25,16 @@ void test_if_exists_stmts() { } } +int if_exists_creates_no_scope() { + __if_exists(MayExist::Type) { + int x; // 'x' is declared in the parent scope. + } + __if_not_exists(MayExist::Type_not) { + x++; + } + return x; +} + __if_exists(MayExist::Type) { int var23; }