[C++ PATCH] decls with error_node type

Jason Merrill jason@redhat.com
Mon Jun 3 17:30:00 GMT 2019


On 5/31/19 1:39 PM, Nathan Sidwell wrote:
> I discovered we could occasionally create TYPE_DECLs with 
> error_mark_node type, and then successfully push them into the symbol 
> table!
> 
> I don't think we should be doing this -- it means TREE_TYPE of a 
> TYPE_DECL might not be a type, with resulting ICE fallout.  (When we 
> cons up a VAR_DECL to cope with an undefined lookup we give it int type, 
> to avoid this kind of thing.)
> 
> This patch stops grokdeclarator doing this, by immediately returning 
> error_mark_node.  And added an assert to push_template_decl_real, where 
> I noticed the problem occurring.

> The fallout is some error cascade on symbol lookups that now fail. 

Right, that's why we had the previous behavior, to avoid this extra 
noise.  And then various places check error_operand_p to avoid trying to 
do anything with such a declaration.

Perhaps lookup should return error_mark_node rather than a _DECL with 
error_mark_node type?

Jason



More information about the Gcc-patches mailing list