[C++ PATCH] Fix error handling in build_enumerator (PR c++/37389)

Mark Mitchell mark@codesourcery.com
Tue Sep 9 14:34:00 GMT 2008


Jakub Jelinek wrote:

> 2008-09-09  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR c++/37389
> 	* decl.c (build_enumerator): Handle previous value's DECL_INITIAL
> 	being NULL or error_mark_node.
> 
> 	* g++.dg/parse/enum4.C: New test.

I think checking for NULL should be unnecessary; we should ensure that
the value is at least an error_mark_node.  I would suggest a check for
error_operand_p instead of:

+	      if (prev_value == NULL_TREE || prev_value == error_mark_node)
+		value = error_mark_node;


OK with that change.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713



More information about the Gcc-patches mailing list