[Bug c++/39681] Compile error is not descriptive
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Oct 3 10:08:00 GMT 2011
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
More information about the Gcc-bugs
mailing list