[Bug c++/26997] g++ reports misleading error message when the identifier with error occurs earlier on the same line
manu at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Oct 26 01:59:00 GMT 2008
------- Comment #5 from manu at gcc dot gnu dot org 2008-10-26 01:58 -------
I also have trouble understanding what is going on in
cp_parser_cast_expression. It seems that after parsing a '(type-id)' we cannot
be sure that this is a cast:
/* If ok so far, parse the dependent expression. We cannot be
sure it is a cast. Consider `(T ())'. It is a parenthesized
ctor of T, but looks like a cast to function returning T
without a dependent expression. */
However, can't we check first whether the type-id just parse could be a
constructor? For that to be true,
1. T must be a type that can be constructed
2. I don't think a parenthesized constructor can appear in the same context as
a cast to function. Can't we infer the correct answer by the surroundings?
3. Even if we cannot get it right in the above cases, in the case of (t *) it
is clear that this is not a constructor.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26997
More information about the Gcc-bugs
mailing list