]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/24915 (Overload errors generated without template instantiations for class...
authorMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 20 Dec 2005 04:44:20 +0000 (04:44 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 20 Dec 2005 04:44:20 +0000 (04:44 +0000)
PR c++/24915
* class.c (add_method): Do not treat templates as identical unless
their return types are the same.
PR c++/24915
* g++.dg/template/overload8.C: New test.

From-SVN: r108837

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/overload8.C [new file with mode: 0644]

index b2b30097ac75e99c9e8176c56d2eafb2558cb29a..3c79990b6ce13d7607c28c3de5f78714f4134e9d 100644 (file)
@@ -1,3 +1,69 @@
+2005-12-19  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24915
+       * class.c (add_method): Do not treat templates as identical unless
+       their return types are the same.
+       
+2005-12-12  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/25300
+       * tree.c (build_qualified_name): Return error_mark_node for
+       erroneous input.
+
+2005-12-10  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/25337 
+       * pt.c (tsubst_copy_and_build): Permit dependent types for the
+       object in a class member access expression.
+
+2005-12-10  Terry Laurenzo  <tlaurenzo@gmail.com>
+
+       PR java/9861
+       * mangle.c (write_bare_function_type): Mangle return type for
+       methods of Java classes
+
+2005-12-08  Théodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+       
+       * call.c (build_conditional_expr): Print types in error messages.
+       
+2005-12-07  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       * expr.c (cxx_expand_expr): Call gcc_unreachable instead of abort.
+
+2005-12-07  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
+
+       * cp-gimplify.c (gimplify_cp_loop): Use fold_build3.
+
+2005-12-07  Rafael Ávila de Espíndola  <rafael.espindola@gmail.com>
+
+       * Make-lang.in (c++.all.build, c++.install-normal): Remove.
+
+2005-12-07  Rafael Ávila de Espíndola  <rafael.espindola@gmail.com>
+
+       * Make-lang.in: Remove all dependencies on s-gtype.
+
+2005-12-06  Aldy Hernandez  <aldyh@redhat.com>
+
+       PR C++/24138
+        * decl.c (reshape_init_array_1): Handle max_index of -1.
+
+2005-12-06  Roger Sayle  <roger@eyesopen.com>
+
+       * typeck.c (build_binary_op): Issue warning if either operand of a
+       comparison operator is a string literal, except for testing equality
+       or inequality against NULL.
+
+2005-12-06  Roger Sayle  <roger@eyesopen.com>
+
+       PR c++/25263
+       * decl.c (compute_array_index_type): Check that itype is an
+       INTEGER_CST node before testing/clearing TREE_OVERFLOW.
+
+2005-12-05  Daniel Berlin  <dberlin@dberlin.org>
+
+       * ptree.c (cxx_print_decl): Update to check for decl_common
+       structure.
+
 2005-12-02  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/24173
index 9d53e80963d345f501ec69767ca88ef0e639d932..2ccc724247b0c9811b3556708a18adc942b81227 100644 (file)
@@ -982,9 +982,10 @@ add_method (tree type, tree method, tree using_decl)
       for (fns = current_fns; fns; fns = OVL_NEXT (fns))
        {
          tree fn = OVL_CURRENT (fns);
+         tree fn_type;
+         tree method_type;
          tree parms1;
          tree parms2;
-         bool same = 1;
 
          if (TREE_CODE (fn) != TREE_CODE (method))
            continue;
@@ -999,8 +1000,10 @@ add_method (tree type, tree method, tree using_decl)
             functions in the derived class override and/or hide member
             functions with the same name and parameter types in a base
             class (rather than conflicting).  */
-         parms1 = TYPE_ARG_TYPES (TREE_TYPE (fn));
-         parms2 = TYPE_ARG_TYPES (TREE_TYPE (method));
+         fn_type = TREE_TYPE (fn);
+         method_type = TREE_TYPE (method);
+         parms1 = TYPE_ARG_TYPES (fn_type);
+         parms2 = TYPE_ARG_TYPES (method_type);
 
          /* Compare the quals on the 'this' parm.  Don't compare
             the whole types, as used functions are treated as
@@ -1009,23 +1012,26 @@ add_method (tree type, tree method, tree using_decl)
              && ! DECL_STATIC_FUNCTION_P (method)
              && (TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms1)))
                  != TYPE_QUALS (TREE_TYPE (TREE_VALUE (parms2)))))
-           same = 0;
+           continue;
 
-         /* For templates, the template parms must be identical.  */
+         /* For templates, the return type and template parameters
+            must be identical.  */
          if (TREE_CODE (fn) == TEMPLATE_DECL
-             && !comp_template_parms (DECL_TEMPLATE_PARMS (fn),
-                                      DECL_TEMPLATE_PARMS (method)))
-           same = 0;
+             && (!same_type_p (TREE_TYPE (fn_type),
+                               TREE_TYPE (method_type))
+                 || !comp_template_parms (DECL_TEMPLATE_PARMS (fn),
+                                          DECL_TEMPLATE_PARMS (method))))
+           continue;
 
          if (! DECL_STATIC_FUNCTION_P (fn))
            parms1 = TREE_CHAIN (parms1);
          if (! DECL_STATIC_FUNCTION_P (method))
            parms2 = TREE_CHAIN (parms2);
 
-         if (same && compparms (parms1, parms2)
+         if (compparms (parms1, parms2)
              && (!DECL_CONV_FN_P (fn)
-                 || same_type_p (TREE_TYPE (TREE_TYPE (fn)),
-                                 TREE_TYPE (TREE_TYPE (method)))))
+                 || same_type_p (TREE_TYPE (fn_type),
+                                 TREE_TYPE (method_type))))
            {
              if (using_decl)
                {
index 91b7f637611c0fec46d3fd94a0847a673176f9f0..e87eb1d688a2b46b49f1106b38f6dd8036d82ba7 100644 (file)
@@ -1,3 +1,8 @@
+2005-12-19  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/24915
+       * g++.dg/template/overload8.C: New test.
+
 2005-12-19  Kenneth Zadeck <zadeck@naturalbridge.com>
 
        * gcc.c-torture/compile/pr25483 : New test.
diff --git a/gcc/testsuite/g++.dg/template/overload8.C b/gcc/testsuite/g++.dg/template/overload8.C
new file mode 100644 (file)
index 0000000..cc6a05b
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/24915
+
+struct A
+{
+  template<int> void foo() {}
+  template<int> int foo() {}
+};