Skip to content

Commit

Permalink
Merge pull request #2 from NinaRanns/contracts-nonattr
Browse files Browse the repository at this point in the history
fixing parens requirement
  • Loading branch information
villevoutilainen authored May 24, 2024
2 parents 3d589c9 + 7e04c1d commit 045af73
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gcc/cp/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30087,7 +30087,7 @@ cp_parser_contract_attribute_spec (cp_parser *parser, tree attribute,
}
else
{
parens.consume_open (parser);
parens.require_open (parser);
if (postcondition_p && cp_lexer_next_token_is (parser->lexer, CPP_NAME)
&& cp_lexer_peek_nth_token (parser->lexer, 2)->type == CPP_COLON)
identifier = cp_parser_identifier (parser);
Expand Down
1 change: 1 addition & 0 deletions gcc/testsuite/g++.dg/contracts/new/contracts1.C
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ int g2(int a) [[pre: f(a) > a ]]
}

int fun(int n) pre (n > 0 );
void fun2(int n) pre n > 0 ]]; // { dg-error }
void fun2(int n) pre (: n > 0 ]]; // { dg-error }
int fun3(int n) [[ pre : n > 0 ); // { dg-error "expected .]. before " }

Expand Down

0 comments on commit 045af73

Please sign in to comment.