public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111840] New: =delete("can have a reason")?
@ 2023-10-16 21:11 ed at catmur dot uk
2023-10-17 15:00 ` [Bug c++/111840] " redi at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: ed at catmur dot uk @ 2023-10-16 21:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111840
Bug ID: 111840
Summary: =delete("can have a reason")?
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ed at catmur dot uk
Target Milestone: ---
Since 6.1, gcc accepts the following (without warnings at any level):
int f() = delete("should have a reason");
Much as I'd love to be able to write this, gcc seems to be slightly jumping the
gun, since P2573[1][2] hasn't been accepted yet and in fact wasn't even
proposed until almost 6 years after 6.1 was released.
1. https://github.com/cplusplus/papers/issues/1229
2. https://wg21.link/p2573r0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/111840] =delete("can have a reason")?
2023-10-16 21:11 [Bug c++/111840] New: =delete("can have a reason")? ed at catmur dot uk
@ 2023-10-17 15:00 ` redi at gcc dot gnu.org
2023-10-17 15:12 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-10-17 15:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111840
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
Last reconfirmed| |2023-10-17
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We also allow:
int f2() = delete[""];
int f3() = delete{""};
int f3() = delete"";
And this compiles without error!
int f() = delete[{'a'"";
int i = f();
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/111840] =delete("can have a reason")?
2023-10-16 21:11 [Bug c++/111840] New: =delete("can have a reason")? ed at catmur dot uk
2023-10-17 15:00 ` [Bug c++/111840] " redi at gcc dot gnu.org
@ 2023-10-17 15:12 ` mpolacek at gcc dot gnu.org
2023-10-17 21:45 ` cvs-commit at gcc dot gnu.org
2023-10-17 21:46 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-10-17 15:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111840
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
CC| |mpolacek at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
cp_parser_simple_declaration fails to give an error in:
/* Anything else is an error. */
else
{
/* If we have already issued an error message we don't need
to issue another one. */
if ((decl != error_mark_node
&& DECL_INITIAL (decl) != error_mark_node)
|| cp_parser_uncommitted_to_tentative_parse_p (parser))
cp_parser_error (parser, "expected %<,%> or %<;%>");
/* Skip tokens until we reach the end of the statement. */
cp_parser_skip_to_end_of_statement (parser);
/* If the next token is now a `;', consume it. */
if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
cp_lexer_consume_token (parser->lexer);
goto done;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/111840] =delete("can have a reason")?
2023-10-16 21:11 [Bug c++/111840] New: =delete("can have a reason")? ed at catmur dot uk
2023-10-17 15:00 ` [Bug c++/111840] " redi at gcc dot gnu.org
2023-10-17 15:12 ` mpolacek at gcc dot gnu.org
@ 2023-10-17 21:45 ` cvs-commit at gcc dot gnu.org
2023-10-17 21:46 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-10-17 21:45 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111840
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:1fbb7d75abbb050f790d8b43422602ee4b152608
commit r14-4694-g1fbb7d75abbb050f790d8b43422602ee4b152608
Author: Marek Polacek <polacek@redhat.com>
Date: Tue Oct 17 16:11:11 2023 -0400
c++: accepts-invalid with =delete("") [PR111840]
r6-2367 added a DECL_INITIAL check to cp_parser_simple_declaration
so that we don't emit multiple errors in g++.dg/parse/error57.C.
But that means we don't diagnose
int f1() = delete("george_crumb");
anymore, because fn decls often have error_mark_node in their
DECL_INITIAL. (The code may be allowed one day via
https://wg21.link/P2573R0.)
I was hoping I could use cp_parser_error_occurred but that would
regress error57.C.
PR c++/111840
gcc/cp/ChangeLog:
* parser.cc (cp_parser_simple_declaration): Do cp_parser_error
for FUNCTION_DECLs.
gcc/testsuite/ChangeLog:
* g++.dg/parse/error65.C: New test.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/111840] =delete("can have a reason")?
2023-10-16 21:11 [Bug c++/111840] New: =delete("can have a reason")? ed at catmur dot uk
` (2 preceding siblings ...)
2023-10-17 21:45 ` cvs-commit at gcc dot gnu.org
@ 2023-10-17 21:46 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-10-17 21:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111840
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed in 14.0, not backporting.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-17 21:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-16 21:11 [Bug c++/111840] New: =delete("can have a reason")? ed at catmur dot uk
2023-10-17 15:00 ` [Bug c++/111840] " redi at gcc dot gnu.org
2023-10-17 15:12 ` mpolacek at gcc dot gnu.org
2023-10-17 21:45 ` cvs-commit at gcc dot gnu.org
2023-10-17 21:46 ` mpolacek at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).