This is the mail archive of the 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]

Re: [C++ PATCH for 3.4/4.0] Fix PR18123 (check error_mark_node inpushtag)

Kriang Lerdsuwanakij wrote:


This is a case of checking for 'error_mark_node' in 'pushtag'.
'maybe_process_template_type_declaration' may return 'error_mark_node'
which should not be pushed into the scope in later pushdecl_* functons.
However, we cannot return immediately as the caller will use the
type node for further processing.  So we need to keep the type node
consistent by setting its TYPE_STUB_DECL.

Tested on i686-pc-linux-gnu.  OK for the mainline and 3.4 (after 3.4.3
is released)?

I think it would be more robust to do a change similar to my recent fix for 18155. In particular, put a check in cp_parser_single_declaration for "enum", and issue the error there. That keeps us from even trying to create tree structures for this type. Arguably, that will hurt error recovery in that we don't know what this thing is a type at all -- but I am not concerned. The first error message will be very sensible, and trying to make the front end deal with semi-bogus types/declarations is very error-prone.

Mark Mitchell
CodeSourcery, LLC
(916) 791-8304

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