Hi,
> Let me know if you need additional details, or what else.

How is the template case failing?
Some preliminary notes, maybe you can already make some sense out of this, more later, if you like:

Thus we have this testcase:

template <class V>
  struct impl
  {
    template <class T> static T create();
  };

template <class T, class U, class V, class
      = decltype(impl<V>::template create<T>()
             -> impl<V>::template create<U>())>
struct tester { };

tester<impl<float>*, int, float> ti;

//////////////////

We are in tsubst_copy_and_build, COMPONENT_REF case. Argument t is:

<component_ref 0x7ffff57810e0
    arg 0 <arrow_expr 0x7ffff5769f00
        arg 0 <call_expr 0x7ffff57810a8
fn <scope_ref 0x7ffff563db40 tree_0 tree_1 arg 0 <record_type 0x7ffff577f540 impl>
                arg 1 <template_id_expr 0x7ffff563da80
                    arg 0 <identifier_node 0x7ffff577e790 create
                        bindings <(nil)>
                        local bindings <(nil)>>
arg 1 <tree_vec 0x7ffff5769e38 elt 0 <template_type_parm 0x7ffff577f348 T>>>>>>
    arg 1 <scope_ref 0x7ffff563db70 tree_0 tree_1
        arg 0 <record_type 0x7ffff577f540 impl type_0 type_5 type_6 VOID
align 8 symtab 0 alias set -1 canonical type 0x7ffff577f540 context <translation_unit_decl 0x7ffff5646170 D.1>
            full-name "struct impl<V>"
            no-binfo use_template=1 interface-unknown
            chain <type_decl 0x7ffff5780170 impl>>
arg 1 <template_id_expr 0x7ffff563dae0 arg 0 <identifier_node 0x7ffff577e790 create> arg 1 <tree_vec 0x7ffff5769ed8 elt 0 <template_type_parm 0x7ffff577f3f0 U>>>>>

Everything begins like the non-template case: member is computed, we get to:

else if (TREE_CODE (member) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (member, 1)) == TEMPLATE_ID_EXPR)

in here we have a call of lookup_qualified_name (TREE_OPERAND (member, 0), tmpl, ... which, in this case, fails, returns error_mark_node (Seg Fault immediately after).

When lookup_qualified_name is called, this is member:

<scope_ref 0x7ffff563dd20 tree_0 tree_1
    arg 0 <record_type 0x7ffff577f9d8 impl type_0 type_5 type_6 VOID
align 8 symtab 0 alias set -1 canonical type 0x7ffff577f9d8 context <translation_unit_decl 0x7ffff5646170 D.1>
        full-name "struct impl<V>"
        no-binfo use_template=1 interface-unknown
        chain <type_decl 0x7ffff57802e0 impl>>
    arg 1 <template_id_expr 0x7ffff563dcf0
type <lang_type 0x7ffff5765888 unknown type type <lang_type 0x7ffff5765888 unknown type>
            VOID
            align 1 symtab 0 alias set -1 canonical type 0x7ffff5765888
pointer_to_this <lang_type 0x7ffff5765888 unknown type> reference_to_this <lang_type 0x7ffff5765888 unknown type>>

        arg 0 <identifier_node 0x7ffff577e790 create
            bindings <(nil)>
            local bindings <(nil)>>
arg 1 <tree_vec 0x7ffff5783140 elt 0 <template_type_parm 0x7ffff577f7e0 U>>>>

and this is tmpl:

<identifier_node 0x7ffff577e790 create bindings <(nil)> local bindings <(nil)>>

For comparison, in the non-template case, path inside COMPONENT_REF is rather different after member: none of the if branches is executed, we just get to return finish_class_member_access_expr at the end of case COMPONENT_REF.

Thanks!
Paolo.





Reply via email to