Commit 4cabb798 by Jason Merrill

(type_unification): If not passing to a reference, strip cv-quals.

 (type_unification): If not passing to a reference, strip
        cv-quals.  Also handle array->pointer conversion.

From-SVN: r8255
parent a827d149
......@@ -1251,6 +1251,8 @@ expr_or_declarator:
{ $$ = build_parse_node (INDIRECT_REF, $2); }
| '&' expr_or_declarator %prec UNARY
{ $$ = build_parse_node (ADDR_EXPR, $2); }
| '(' expr_or_declarator ')'
{ $$ = $2; }
;
direct_notype_declarator:
......@@ -1259,6 +1261,8 @@ direct_notype_declarator:
| notype_qualified_id
{ push_nested_class (TREE_TYPE (OP0 ($$)), 3);
TREE_COMPLEXITY ($$) = current_class_depth; }
| '(' expr_or_declarator ')'
{ $$ = finish_decl_parsing ($2); }
;
primary:
......@@ -2831,8 +2835,6 @@ complex_direct_notype_declarator:
{ $$ = build_parse_node (CALL_EXPR, $$, empty_parms (), $3); }
| direct_notype_declarator '(' error ')' type_quals %prec '.'
{ $$ = build_parse_node (CALL_EXPR, $$, NULL_TREE, NULL_TREE); }
| '(' expr_or_declarator ')'
{ $$ = finish_decl_parsing ($2); }
| '(' complex_notype_declarator ')'
{ $$ = $2; }
| direct_notype_declarator '[' nonmomentary_expr ']'
......
......@@ -2008,9 +2008,16 @@ type_unification (tparms, targs, parms, args, nsubsts, subr)
arg = TREE_TYPE (arg);
}
#endif
if (TREE_CODE (arg) == FUNCTION_TYPE
|| TREE_CODE (arg) == METHOD_TYPE)
arg = build_pointer_type (arg);
if (TREE_CODE (parm) != REFERENCE_TYPE)
{
if (TREE_CODE (arg) == FUNCTION_TYPE
|| TREE_CODE (arg) == METHOD_TYPE)
arg = build_pointer_type (arg);
else if (TREE_CODE (arg) == ARRAY_TYPE)
arg = build_pointer_type (TREE_TYPE (arg));
else
arg = TYPE_MAIN_VARIANT (arg);
}
switch (unify (tparms, targs, ntparms, parm, arg, nsubsts))
{
......@@ -2428,6 +2435,7 @@ do_function_instantiation (declspecs, declarator, storage)
TREE_PUBLIC (result) = 1;
DECL_EXTERNAL (result) = (DECL_INLINE (result)
&& ! flag_implement_inlines);
TREE_STATIC (result) = ! DECL_EXTERNAL (result);
}
else if (storage == ridpointers[(int) RID_EXTERN])
;
......@@ -2506,6 +2514,7 @@ do_type_instantiation (name, storage)
TREE_PUBLIC (tmp) = 1;
DECL_EXTERNAL (tmp) = (DECL_INLINE (tmp)
&& ! flag_implement_inlines);
TREE_STATIC (tmp) = ! DECL_EXTERNAL (tmp);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment