diff mbox

[C++,RFC,/] Again about PR 70202

Message ID 5759FBC7.5080503@oracle.com
State New
Headers show

Commit Message

Paolo Carlini June 9, 2016, 11:29 p.m. UTC
Hi,

On 09/06/2016 23:38, Jason Merrill wrote:
> I would think that when we see a duplicated base we should just drop
> the duplicates and continue.
>
> If the type of b1 is error_mark_node, why isn't the type of b2 also
> error_mark_node?
Thanks Jason. Normally check_initializer massages the decl basing on the 
init and so to speak transforms an error_mark_node as TREE_TYPE of the 
init into an error_mark_node as DECL_INITIAL of a reference. Thus we 
don't see error_mark_node as TREE_TYPE of b2. Now if I do something as 
trivial as the attached the testcase passes.

Next step, analyze the huge breakage caused by that change, I don't dare 
running the testsuite ;)

Thanks,
Paolo.

///////////////////
diff mbox

Patch

Index: decl.c
===================================================================
--- decl.c	(revision 237280)
+++ decl.c	(working copy)
@@ -6002,6 +6002,12 @@  check_initializer (tree decl, tree init, int flags
   tree init_code = NULL;
   tree core_type;
 
+  if (TREE_TYPE (init) == error_mark_node)
+    {
+      TREE_TYPE (decl) = error_mark_node;
+      return NULL_TREE;
+    }
+
   /* Things that are going to be initialized need to have complete
      type.  */
   TREE_TYPE (decl) = type = complete_type (TREE_TYPE (decl));