This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/26997] g++ reports misleading error message when the identifier with error occurs earlier on the same line
- From: "manu at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Oct 2008 01:58:29 -0000
- Subject: [Bug c++/26997] g++ reports misleading error message when the identifier with error occurs earlier on the same line
- References: <bug-26997-10573@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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