This is the mail archive of the gcc-bugs@gcc.gnu.org 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]

[Bug c++/71450] [5/6/7 Regression] ICE on invalid C++11 code on x86_64-linux-gnu: in tree check: expected record_type or union_type or qual_union_type, have template_type_parm in lookup_base, at cp/search.c:203


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71450

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |paolo at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Makes me wonder why are we not returning error_mark_node if mark_used fails.

--- gcc/cp/pt.c.jj      2016-11-18 20:04:26.000000000 +0100
+++ gcc/cp/pt.c 2016-11-23 10:52:22.886009417 +0100
@@ -14144,7 +14144,7 @@ tsubst_copy (tree t, tree args, tsubst_f

       if (TREE_CODE (r) == ARGUMENT_PACK_SELECT)
        r = ARGUMENT_PACK_SELECT_ARG (r);
-      if (!mark_used (r, complain) && !(complain & tf_error))
+      if (!mark_used (r, complain))
        return error_mark_node;
       return r;

@@ -14297,7 +14297,7 @@ tsubst_copy (tree t, tree args, tsubst_f
        }
       else
        r = t;
-      if (!mark_used (r, complain) && !(complain & tf_error))
+      if (!mark_used (r, complain))
        return error_mark_node;
       return r;

fixes the ICE (but is completely untested and there are tons of other places
where something similar is used).
Even on simpler:
template <class T>
void g (T t)
{ 
  auto x = t + x;
}

int
main ()
{ 
  g (1);
  return 0;
}
we emit:
pr71450-3.C: In instantiation of ‘void g(T) [with T = int]’:
pr71450-3.C:10:7:   required from here
pr71450-3.C:4:14: error: use of ‘x’ before deduction of ‘auto’
   auto x = t + x;
            ~~^~~
pr71450-3.C:4:8: error: ‘x’ has incomplete type
   auto x = t + x;
        ^
pr71450-3.C:4:14: error: invalid use of ‘auto’
   auto x = t + x;
            ~~^~~
and with the patch just:
pr71450-3.C: In instantiation of ‘void g(T) [with T = int]’:
pr71450-3.C:10:7:   required from here
pr71450-3.C:4:14: error: use of ‘x’ before deduction of ‘auto’
   auto x = t + x;
            ~~^~~

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