[Bug c++/118147] #pragma GCC diagnostic push causes errors when used in IILE in struct member initializer
nshead at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Dec 20 06:39:11 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118147
Nathaniel Shead <nshead at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-12-20
Ever confirmed|0 |1
CC| |nshead at gcc dot gnu.org
Status|UNCONFIRMED |NEW
--- Comment #1 from Nathaniel Shead <nshead at gcc dot gnu.org> ---
Confirmed. The following (untested) minimal patch seems to fix the issue:
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 23c6a2fd30e..527a858ea52 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -36316,7 +36316,6 @@ cp_parser_cache_defarg (cp_parser *parser, bool nsdmi)
/* If we run out of tokens, issue an error message. */
case CPP_EOF:
- case CPP_PRAGMA_EOL:
error_at (token->location, "file ends in default argument");
return error_mark_node;
I'm not sure why CPP_PRAGMA_EOL is treated as EOF here in the first place?
More information about the Gcc-bugs
mailing list