This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]