* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
@ 2011-10-02 10:07 ` paolo.carlini at oracle dot com
2011-10-03 10:08 ` manu at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-02 10:07 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC|gcc-bugs at gcc dot gnu.org |manu at gcc dot gnu.org
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-02 10:07:33 UTC ---
Manuel, can I have your opinion about this one?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
2011-10-02 10:07 ` [Bug c++/39681] Compile error is not descriptive paolo.carlini at oracle dot com
@ 2011-10-03 10:08 ` manu at gcc dot gnu.org
2011-10-03 11:09 ` paolo.carlini at oracle dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2011-10-03 10:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-10-03 10:07:49 UTC ---
(In reply to comment #2)
> Manuel, can I have your opinion about this one?
Since you ask, my opinion is that first there should be only 1 error and not
two, and bonus points if the error is something like "'foo' is not a type".
Clang says:
/tmp/webcompile/_9832_0.cc:4:18: error: expected a type
int* p = new foo;
^
1 error generated.
On the other hand, I understand that this may be difficult to fix with g++
tentative parser. The fix could be something like, once "new" is seen, then
commit to parse a new-expression. But I haven't looked at this code
specifically.
Interestingly, for:
int main()
{
int* p = delete foo;
}
g++ says:
test.cc:3:21: error: ‘foo’ was not declared in this scope
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
2011-10-02 10:07 ` [Bug c++/39681] Compile error is not descriptive paolo.carlini at oracle dot com
2011-10-03 10:08 ` manu at gcc dot gnu.org
@ 2011-10-03 11:09 ` paolo.carlini at oracle dot com
2011-10-03 11:14 ` paolo.carlini at oracle dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-03 11:09 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-03 11:08:39 UTC ---
Ok, thanks. Frankly I hadn't noticed the *second* error. The first one seemed
good enough to me, and quite similar to what I saw elsewhere modulo type
instead of type-specifier. So do you think it would be possible to get rid of
the stupid second error message within the current infrastructure?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2011-10-03 11:09 ` paolo.carlini at oracle dot com
@ 2011-10-03 11:14 ` paolo.carlini at oracle dot com
2012-05-14 11:33 ` manu at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-03 11:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-03 11:13:52 UTC ---
Like, sorry about my naivete, by adding a cp_parser_skip_to_end_of_statement or
something right after the error message?!?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2011-10-03 11:14 ` paolo.carlini at oracle dot com
@ 2012-05-14 11:33 ` manu at gcc dot gnu.org
2012-05-14 16:43 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-14 11:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Target|i486-linux-gnu |
Status|UNCONFIRMED |NEW
Last reconfirmed| |2012-05-14
Host|i486-linux-gnu |
Ever Confirmed|0 |1
Build|i486-linux-gnu |
--- Comment #6 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-14 11:22:43 UTC ---
This is confirmed and the error should be exactly:
error: ‘foo’ was not declared in this scope
like it happens with "delete".
Not working on it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2012-05-14 11:33 ` manu at gcc dot gnu.org
@ 2012-05-14 16:43 ` redi at gcc dot gnu.org
2012-05-14 16:44 ` manu at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: redi at gcc dot gnu.org @ 2012-05-14 16:43 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-05-14 16:07:32 UTC ---
I agree it should be better, but the analogy isn't great: "new foo" requires
foo to be a type, "delete foo" requires foo to be a variable.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
` (5 preceding siblings ...)
2012-05-14 16:43 ` redi at gcc dot gnu.org
@ 2012-05-14 16:44 ` manu at gcc dot gnu.org
2012-05-17 19:02 ` paolo.carlini at oracle dot com
2012-05-17 19:25 ` paolo at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: manu at gcc dot gnu.org @ 2012-05-14 16:44 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
--- Comment #8 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-05-14 16:42:44 UTC ---
(In reply to comment #5)
> Like, sorry about my naivete, by adding a cp_parser_skip_to_end_of_statement or
> something right after the error message?!?
That may work and the result should be kind of ok. Anyway, g++ cannot do much
else with 'foo' (no spell-corrector, no searching in enclosing namespaces,
etc.).
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
` (6 preceding siblings ...)
2012-05-14 16:44 ` manu at gcc dot gnu.org
@ 2012-05-17 19:02 ` paolo.carlini at oracle dot com
2012-05-17 19:25 ` paolo at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: paolo.carlini at oracle dot com @ 2012-05-17 19:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.8.0
--- Comment #10 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-05-17 18:58:22 UTC ---
Done.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c++/39681] Compile error is not descriptive
[not found] <bug-39681-4@http.gcc.gnu.org/bugzilla/>
` (7 preceding siblings ...)
2012-05-17 19:02 ` paolo.carlini at oracle dot com
@ 2012-05-17 19:25 ` paolo at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: paolo at gcc dot gnu.org @ 2012-05-17 19:25 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681
--- Comment #9 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2012-05-17 18:54:45 UTC ---
Author: paolo
Date: Thu May 17 18:54:37 2012
New Revision: 187634
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=187634
Log:
/cp
2012-05-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/39681
* parser.c (cp_parser_new_type_id): Early return error_mark_node
if the cp_parser_type_specifier_seq call has type_specifier_seq.type
error_mark_node; tidy.
(cp_parser_new_expression): Always initialize nelts to NULL_TREE to
avoid uninitialized warnings.
(cp_parser_init_declarator, cp_parser_late_parse_one_default_arg):
Call cp_parser_skip_to_end_of_statement if cp_parser_initializer
returns error_mark_node.
/testsuite
2012-05-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/39681
* g++.dg/parse/error48.C: New.
* g++.dg/cpp0x/error8.C: Likewise.
* g++.dg/ext/utf-cxx98.C: Adjust dg-error directive.
* g++.dg/ext/utf-dflt2.C: Likewise.
* g++.dg/ext/utf-gnuxx98.C: Likewise.
* g++.dg/ext/utf-dflt.C: Likewise.
* c-c++-common/raw-string-3.c: Likewise.
* c-c++-common/raw-string-4.c: Likewise.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/error8.C
trunk/gcc/testsuite/g++.dg/parse/error49.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/parser.c
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/c-c++-common/raw-string-3.c
trunk/gcc/testsuite/c-c++-common/raw-string-4.c
trunk/gcc/testsuite/g++.dg/ext/utf-cxx98.C
trunk/gcc/testsuite/g++.dg/ext/utf-dflt.C
trunk/gcc/testsuite/g++.dg/ext/utf-dflt2.C
trunk/gcc/testsuite/g++.dg/ext/utf-gnuxx98.C
^ permalink raw reply [flat|nested] 10+ messages in thread