================
@@ -1899,6 +1927,12 @@ Sema::ConditionResult 
Parser::ParseCXXCondition(StmtResult *InitStmt,
     //   if (; true);
     if (InitStmt && Tok.is(tok::semi)) {
       WarnOnInit();
+      if (!getLangOpts().CPlusPlus && !InitStmt->get()) {
+        Diag(Tok.getLocation(),
+             diag::err_c2y_first_condition_clause_is_not_declaration);
+        Actions.ActOnNullStmt(ConsumeToken());
+        return ParseCondition(nullptr, Loc, CK, MissingOK);
+      }
----------------
Sirraide wrote:

It does seem like allowing `NullStmt` below and disallowing it here is a better 
approach; instead of doing this here, can you merge this into the if statement 
above where we build the attributed statement (see my next comment)?

https://github.com/llvm/llvm-project/pull/198244
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to