Hi,

On 08/15/2014 09:22 PM, Jason Merrill wrote:
On 08/15/2014 03:16 PM, Paolo Carlini wrote:
+  bool in_function = (TREE_TYPE (tparms)
+              && DECL_FUNCTION_TEMPLATE_P (TREE_TYPE (tparms)));

Huh?  There's no such thing as a template parameter of function type.
Works fine, in fact, I have just finished regtesting the patch. Consider, eg, from the DR:

template<class T> void f2(const T*);
void g2();

void m() {
  f2(g2);    // OK: cv-qualification of deduced function type ignored
}

when unify is called by unify_one_argument is a TREE_VEC and the TREE_TYPE contains the information we need:

 <tree_vec 0x7ffff6da7300
    type <template_decl 0x7ffff6da9100 f2
type <function_type 0x7ffff6daa150 type <void_type 0x7ffff6c48f18 void>
            type_0 type_6 QI
            size <integer_cst 0x7ffff6c2eed0 constant 8>
            unit size <integer_cst 0x7ffff6c2eee8 constant 1>
            align 8 symtab 0 alias set -1 canonical type 0x7ffff6daa150
arg-types <tree_list 0x7ffff6d99370 value <pointer_type 0x7ffff6daa0a8> chain <tree_list 0x7ffff6c3eb40 value <void_type 0x7ffff6c48f18 void>>>>
        VOID file 57466_1.C line 3 col 24
        align 1 context <translation_unit_decl 0x7ffff7ff7078 D.1>
        full-name "template<class T> void f2(const T*)"

chain <function_decl 0x7ffff6d95600 __cxa_call_unexpected type <function_type 0x7ffff6c5b0a8> volatile public external QI file <built-in> line 0 col 0 align 8
            full-name "void __cxa_call_unexpected(void*)"
            chain <function_decl 0x7ffff6d95200 operator delete []>>>

    elt 0 <tree_list 0x7ffff6d992f8
value <type_decl 0x7ffff6d982f8 T type <template_type_parm 0x7ffff6d97f18 T>
            decl_0 VOID file 57466_1.C line 3 col 10
            align 1>>>

Paolo.

Reply via email to