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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I'd go with:
--- gcc/cp/tree.c.jj    2018-03-21 21:18:31.738351376 +0100
+++ gcc/cp/tree.c       2018-03-26 11:22:47.067967708 +0200
@@ -1078,6 +1078,9 @@ cp_build_reference_type (tree to_type, b
 {
   tree lvalue_ref, t;

+  if (to_type == error_mark_node)
+    return error_mark_node;
+
   if (TREE_CODE (to_type) == REFERENCE_TYPE)
     {
       rval = rval && TYPE_REF_IS_RVALUE (to_type);
That matches what build_pointer_type and build_reference_type do as well.

Reply via email to