diff options
author | Jason Merrill <merrill@gnu.org> | 1994-10-11 18:43:39 +0000 |
---|---|---|
committer | Jason Merrill <merrill@gnu.org> | 1994-10-11 18:43:39 +0000 |
commit | 4cabb7984ddfaece71d1a0a2c92d19e479bf6b20 (patch) | |
tree | ce0027d0b814e4c65f8869661ccaebfe5bb9588c /gcc | |
parent | a827d14969e17fb10508f6c7dfcc2c87e99ecc0d (diff) | |
download | gcc-4cabb7984ddfaece71d1a0a2c92d19e479bf6b20.zip gcc-4cabb7984ddfaece71d1a0a2c92d19e479bf6b20.tar.gz gcc-4cabb7984ddfaece71d1a0a2c92d19e479bf6b20.tar.bz2 |
(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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/parse.y | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 15 |
2 files changed, 16 insertions, 5 deletions
diff --git a/gcc/cp/parse.y b/gcc/cp/parse.y index 36c8aac..0e6836d 100644 --- a/gcc/cp/parse.y +++ b/gcc/cp/parse.y @@ -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 ']' diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ad60480..830a6b9 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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); } } |