Skip to content

Commit

Permalink
Warn if the user puts a semicolon after closing brace of a type defin…
Browse files Browse the repository at this point in the history
…ition (like in Cpp1) (#931)
  • Loading branch information
bluetarpmedia authored Jan 16, 2024
1 parent 68120f8 commit 3b4b5ba
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions source/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -8490,6 +8490,18 @@ class parser

}

if (
n->is_type()
&& n->initializer
&& !done() && curr().type() == lexeme::Semicolon
)
{
if (n->initializer->is_compound() && n->has_name()) {
error("Cpp2 does not allow a semicolon after the closing brace of a type definition");
return {};
}
}

// A type initializer must be a compound expression
if (
n->is_type()
Expand Down

0 comments on commit 3b4b5ba

Please sign in to comment.