OSDN Git Service

(type_unification): If not passing to a reference, strip
authormerrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Oct 1994 18:43:39 +0000 (18:43 +0000)
committermerrill <merrill@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Oct 1994 18:43:39 +0000 (18:43 +0000)
        cv-quals.  Also handle array->pointer conversion.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@8255 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/parse.y
gcc/cp/pt.c

index 36c8aac..0e6836d 100644 (file)
@@ -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 ']'
index ad60480..830a6b9 100644 (file)
@@ -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);
          }
       }