Hi,

On 09/14/2012 04:36 PM, Jason Merrill wrote:
On 09/14/2012 09:05 AM, Paolo Carlini wrote:
here we crash because strip_typedefs while processing _RequireInputIter
calls make_typename_type which returns error_mark_node (# line 3281).

strip_typedefs should not return error_mark_node unless it gets error_mark_node as an argument; if a typedef-using type is valid, removing the typedefs should still produce a valid type.
I see, makes sense. What I'm seeing is that make_typename_type, called for this context (the enable_if):

 <record_type 0x7ffff694ac78 enable_if type_0 type_5 type_6 VOID
align 8 symtab 0 alias set -1 canonical type 0x7ffff694ac78 context <translation_unit_decl 0x7ffff67fd170 D.1>
    full-name "struct enable_if<is_convertible<int, bool>::value>"
    no-binfo use_template=1 interface-unknown
    chain <type_decl 0x7ffff694d170 enable_if>>

wants to return error_mark_node, because here:

  if (!dependent_scope_p (context))
    /* We should only set WANT_TYPE when we're a nested typename type.
       Then we can give better diagnostics if we find a non-type. */
    t = lookup_field (context, name, 2, /*want_type=*/true);
  else
    t = NULL_TREE;

  if ((!t || TREE_CODE (t) == TREE_LIST) && dependent_type_p (context))
    return build_typename_type (context, name, fullname, tag_type);

  want_template = TREE_CODE (fullname) == TEMPLATE_ID_EXPR;

  if (!t)
    {
      if (complain & tf_error)
    error (want_template ? G_("no class template named %q#T in %q#T")
           : G_("no type named %q#T in %q#T"), name, context);
      return error_mark_node;
    }

lookup_field returns NULL_TREE and dependent_type_p (context) is false. It seems to me that the return value of lookup_field is right. Thus either dependent_type_p shouldn't be false or something is wrong in the logic or strip_typedefs should not call make_typename_type at all?!?

Paolo.


Reply via email to