Hi,

while looking a bit into c++/71169 I noticed that in one place we first call tsubst_aggr_type and tubst_copy and then we check if either returned error_mark_node. Performance-wise, it would be better to check as soon as possible the return value of the former and in case return immediately without calling the latter. That assuming I'm not missing something of course... but the below passes testing.

Thanks,
Paolo.

//////////////////////
Index: pt.c
===================================================================
--- pt.c        (revision 237196)
+++ pt.c        (working copy)
@@ -13430,10 +13430,12 @@ tsubst (tree t, tree args, tsubst_flags_t complain
       {
        tree ctx = tsubst_aggr_type (TYPE_CONTEXT (t), args, complain,
                                     in_decl, /*entering_scope=*/1);
+       if (ctx == error_mark_node)
+         return error_mark_node;
+
        tree f = tsubst_copy (TYPENAME_TYPE_FULLNAME (t), args,
                              complain, in_decl);
-
-       if (ctx == error_mark_node || f == error_mark_node)
+       if (f == error_mark_node)
          return error_mark_node;
 
        if (!MAYBE_CLASS_TYPE_P (ctx))

Reply via email to