[Bug c++/39681] Compile error is not descriptive

2012-05-17 Thread paolo.carlini at oracle dot com
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.


[Bug c++/39681] Compile error is not descriptive

2012-05-17 Thread paolo at gcc dot gnu.org
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=gccview=revrev=187634
Log:
/cp
2012-05-17  Paolo Carlini  paolo.carl...@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.carl...@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


[Bug c++/39681] Compile error is not descriptive

2012-05-14 Thread manu at gcc dot gnu.org
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.


[Bug c++/39681] Compile error is not descriptive

2012-05-14 Thread redi at gcc dot gnu.org
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.


[Bug c++/39681] Compile error is not descriptive

2012-05-14 Thread manu at gcc dot gnu.org
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.).


[Bug c++/39681] Compile error is not descriptive

2011-10-03 Thread manu at gcc dot gnu.org
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


[Bug c++/39681] Compile error is not descriptive

2011-10-03 Thread paolo.carlini at oracle dot com
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?


[Bug c++/39681] Compile error is not descriptive

2011-10-03 Thread paolo.carlini at oracle dot com
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?!?


[Bug c++/39681] Compile error is not descriptive

2011-10-02 Thread paolo.carlini at oracle dot com
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?


[Bug c++/39681] Compile error is not descriptive

2009-04-07 Thread paolo dot carlini at oracle dot com


--- Comment #1 from paolo dot carlini at oracle dot com  2009-04-07 15:37 
---
FWIW, the EDG C++ front-end issues a very similar error message ;)

39681.C(3): error: expected a type specifier
  int* p = new foo;
   ^


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39681