break;
}
+ case tok::kw___if_exists:
+ case tok::kw___if_not_exists:
+ ProhibitAttributes(Attrs);
+ ParseMicrosoftIfExistsStatement(Stmts);
+ // An __if_exists block is like a compound statement, but it doesn't create
+ // a new scope.
+ return StmtEmpty();
+
case tok::kw_try: // C++ 15: try-block
return ParseCXXTryBlock();
continue;
}
- if (getLangOpts().MicrosoftExt && (Tok.is(tok::kw___if_exists) ||
- Tok.is(tok::kw___if_not_exists))) {
- ParseMicrosoftIfExistsStatement(Stmts);
- continue;
- }
-
StmtResult R;
if (Tok.isNot(tok::kw___extension__)) {
R = ParseStatementOrDeclaration(Stmts, false);
// RUN: %clang_cc1 %s -std=c++11 -fsyntax-only -Wmicrosoft -verify -fms-extensions
-// expected-no-diagnostics
-
class MayExist {
private:
typedef int Type;
int var244;
}
};
+
+void test_nested_if_exists() {
+ __if_exists(MayExist::Type) {
+ int x = 42;
+ __if_not_exists(MayExist::Type_not) {
+ x++;
+ }
+ }
+}
+
+void test_attribute_on_if_exists() {
+ [[clang::fallthrough]] // expected-error {{an attribute list cannot appear here}}
+ __if_exists(MayExist::Type) {
+ int x;
+ }
+}