r211650 - Add a missing test for the __if_exists extension

Reid Kleckner reid at kleckner.net
Tue Jun 24 17:10:50 PDT 2014


Author: rnk
Date: Tue Jun 24 19:10:50 2014
New Revision: 211650

URL: http://llvm.org/viewvc/llvm-project?rev=211650&view=rev
Log:
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.

Modified:
    cfe/trunk/test/Parser/ms-if-exists.cpp

Modified: cfe/trunk/test/Parser/ms-if-exists.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/ms-if-exists.cpp?rev=211650&r1=211649&r2=211650&view=diff
==============================================================================
--- cfe/trunk/test/Parser/ms-if-exists.cpp (original)
+++ cfe/trunk/test/Parser/ms-if-exists.cpp Tue Jun 24 19:10:50 2014
@@ -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;
 }





More information about the cfe-commits mailing list