Commit 4789c23b by Marek Polacek Committed by Marek Polacek

PR c++/64235 - missing syntax error with invalid alignas.

	* parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
	if there's a missing close paren.

	* g++.dg/parse/alignas1.C: New test.

From-SVN: r272570
parent 9b15893c
2019-06-21 Marek Polacek <polacek@redhat.com> 2019-06-21 Marek Polacek <polacek@redhat.com>
PR c++/64235 - missing syntax error with invalid alignas.
* parser.c (cp_parser_std_attribute_spec): Commit to tentative parse
if there's a missing close paren.
PR c++/90490 - fix decltype issues in noexcept-specifier. PR c++/90490 - fix decltype issues in noexcept-specifier.
* except.c (build_noexcept_spec): Call * except.c (build_noexcept_spec): Call
instantiate_non_dependent_expr_sfinae before instantiate_non_dependent_expr_sfinae before
......
...@@ -26371,6 +26371,12 @@ cp_parser_std_attribute_spec (cp_parser *parser) ...@@ -26371,6 +26371,12 @@ cp_parser_std_attribute_spec (cp_parser *parser)
if (alignas_expr == error_mark_node) if (alignas_expr == error_mark_node)
return error_mark_node; return error_mark_node;
/* Missing ')' means the code cannot possibly be valid; go ahead
and commit to make sure we issue a hard error. */
if (cp_parser_uncommitted_to_tentative_parse_p (parser)
&& cp_lexer_next_token_is_not (parser->lexer, CPP_CLOSE_PAREN))
cp_parser_commit_to_tentative_parse (parser);
if (!parens.require_close (parser)) if (!parens.require_close (parser))
return error_mark_node; return error_mark_node;
2019-06-19 Marek Polacek <polacek@redhat.com>
PR c++/64235 - missing syntax error with invalid alignas.
* g++.dg/parse/alignas1.C: New test.
2019-06-21 Steven G. Kargl <kargl@gcc.gnu.org> 2019-06-21 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67884 PR fortran/67884
......
// PR c++/64235
// { dg-do compile { target c++11 } }
struct S {
double d;
};
struct alignas(sizeof(S) S1 { }; // { dg-error "expected '\\)' before 'S1'" }
struct alignas(16 S2 { }; // { dg-error "expected '\\)' before 'S2'" }
struct alignas(int S3 { }; // { dg-error "expected '\\)' before 'S3'" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment