diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-06-25 00:10:50 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-06-25 00:10:50 +0000 |
commit | 450955db5aa414877c6c966660b41472ffd60b52 (patch) | |
tree | 914bb57257826663ebaef3c69dbf4153cc5e3912 | |
parent | 5bd096aef0b9d4caa0c1c8f4a0f28288b6464af8 (diff) | |
download | clang-450955db5aa414877c6c966660b41472ffd60b52.tar.gz clang-450955db5aa414877c6c966660b41472ffd60b52.tar.bz2 clang-450955db5aa414877c6c966660b41472ffd60b52.tar.xz |
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
-rw-r--r-- | test/Parser/ms-if-exists.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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; } |