OSDN Git Service

2010-04-30 Richard Guenther <rguenther@suse.de>
[pf3gnuchains/gcc-fork.git] / gcc / cp / decl2.c
index 4e4930a..d811c9e 100644 (file)
@@ -156,8 +156,9 @@ change_return_type (tree new_ret, tree fntype)
   if (TREE_CODE (fntype) == FUNCTION_TYPE)
     newtype = build_function_type (new_ret, args);
   else
-    newtype = build_method_type_directly (TYPE_METHOD_BASETYPE (fntype),
-                                         new_ret, TREE_CHAIN (args));
+    newtype = build_method_type_directly
+      (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (fntype))),
+       new_ret, TREE_CHAIN (args));
   if (raises)
     newtype = build_exception_variant (newtype, raises);
   if (attrs)
@@ -784,6 +785,10 @@ finish_static_data_member_decl (tree decl,
   DECL_INITIAL (decl) = init;
   DECL_IN_AGGR_P (decl) = 1;
 
+  if (TREE_CODE (TREE_TYPE (decl)) == ARRAY_TYPE
+      && TYPE_DOMAIN (TREE_TYPE (decl)) == NULL_TREE)
+    SET_VAR_HAD_UNKNOWN_BOUND (decl);
+
   cp_finish_decl (decl, init, init_const_expr_p, asmspec_tree, flags);
 }
 
@@ -908,8 +913,13 @@ grokfield (const cp_declarator *declarator,
            }
          else if (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE)
            {
-             gcc_assert (error_operand_p (init) || integer_zerop (init));
-             DECL_PURE_VIRTUAL_P (value) = 1;
+             if (integer_zerop (init))
+               DECL_PURE_VIRTUAL_P (value) = 1;
+             else if (error_operand_p (init))
+               ; /* An error has already been reported.  */
+             else
+               error ("invalid initializer for member function %qD",
+                      value);
            }
          else
            {
@@ -4001,6 +4011,18 @@ mark_used (tree decl)
   if (TREE_CODE (decl) == FUNCTION_DECL
       && DECL_DELETED_FN (decl))
     {
+      if (DECL_ARTIFICIAL (decl))
+       {
+         if (DECL_OVERLOADED_OPERATOR_P (decl) == TYPE_EXPR
+             && LAMBDA_TYPE_P (DECL_CONTEXT (decl)))
+           {
+             /* We mark a lambda conversion op as deleted if we can't
+                generate it properly; see maybe_add_lambda_conv_op.  */
+             sorry ("converting lambda which uses %<...%> to "
+                    "function pointer");
+             return;
+           }
+       }
       error ("deleted function %q+D", decl);
       error ("used here");
       return;