]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/17431 (Internal error: Segmentation fault (program cc1plus))
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 1 Dec 2004 12:58:17 +0000 (12:58 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 1 Dec 2004 12:58:17 +0000 (12:58 +0000)
cp:
PR c++/17431
* call.c (standard_conversion): Add FLAGS parameter. Do not allow
derived to base conversion when checking constructor
accessibility.
(implicit_conversion): Pass FLAGS to standard_conversion.
(check_constructir_callable): Disallow conversion functions.
testsuite:
PR c++/17431
* g++.dg/overload/arg1.C: New.
* g++.dg/overload/arg2.C: New.
* g++.dg/overload/arg3.C: New.
* g++.dg/overload/arg4.C: New.

From-SVN: r91561

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog

index ae4327db45ea3423d24370f78c433535975b60f1..d9f79a8feba9eccc993a967590c9c1d7cf0b8232 100644 (file)
@@ -1,3 +1,12 @@
+2004-12-01  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/17431
+       * call.c (standard_conversion): Add FLAGS parameter. Do not allow
+       derived to base conversion when checking constructor
+       accessibility.
+       (implicit_conversion): Pass FLAGS to standard_conversion.
+       (check_constructir_callable): Disallow conversion functions.
+
 2004-11-12  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/18389
index c4a09baa2339c2bea847e870d03bfaffd9e38270..5114af79f0c13f2b8e1090827a9f7ca6dae2f19e 100644 (file)
@@ -86,7 +86,7 @@ static struct z_candidate *add_conv_candidate
 static struct z_candidate *add_function_candidate 
        (struct z_candidate **, tree, tree, tree, tree, tree, int);
 static tree implicit_conversion (tree, tree, tree, int);
-static tree standard_conversion (tree, tree, tree);
+static tree standard_conversion (tree, tree, tree, int);
 static tree reference_binding (tree, tree, tree, int);
 static tree build_conv (enum tree_code, tree, tree);
 static bool is_subseq (tree, tree);
@@ -454,7 +454,7 @@ strip_top_quals (tree t)
    also pass the expression EXPR to convert from.  */
 
 static tree
-standard_conversion (tree to, tree from, tree expr)
+standard_conversion (tree to, tree from, tree expr, int flags)
 {
   enum tree_code fcode, tcode;
   tree conv;
@@ -505,7 +505,7 @@ standard_conversion (tree to, tree from, tree expr)
          the standard conversion sequence to perform componentwise
          conversion.  */
       tree part_conv = standard_conversion
-        (TREE_TYPE (to), TREE_TYPE (from), NULL_TREE);
+        (TREE_TYPE (to), TREE_TYPE (from), NULL_TREE, flags);
       
       if (part_conv)
         {
@@ -692,7 +692,8 @@ standard_conversion (tree to, tree from, tree expr)
       && ((*targetm.vector_opaque_p) (from)
          || (*targetm.vector_opaque_p) (to)))
     return build_conv (STD_CONV, to, conv);
-  else if (IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
+  else if (!(flags & LOOKUP_CONSTRUCTOR_CALLABLE)
+          && IS_AGGR_TYPE (to) && IS_AGGR_TYPE (from)
           && is_properly_derived_from (from, to))
     {
       if (TREE_CODE (conv) == RVALUE_CONV)
@@ -1105,7 +1106,7 @@ implicit_conversion (tree to, tree from, tree expr, int flags)
   if (TREE_CODE (to) == REFERENCE_TYPE)
     conv = reference_binding (to, from, expr, flags);
   else
-    conv = standard_conversion (to, from, expr);
+    conv = standard_conversion (to, from, expr, flags);
 
   if (conv)
     return conv;
@@ -3878,6 +3879,7 @@ check_constructor_callable (tree type, tree expr)
                             build_tree_list (NULL_TREE, expr), 
                             TYPE_BINFO (type),
                             LOOKUP_NORMAL | LOOKUP_ONLYCONVERTING
+                            | LOOKUP_NO_CONVERSION
                             | LOOKUP_CONSTRUCTOR_CALLABLE);
 }
 
index 695af58565093f098aeafdc25c66ecd0ca09e83f..344b6c6a44ae70e29d9361d58992fdd36750aa80 100644 (file)
@@ -1,3 +1,11 @@
+2004-12-01  Nathan Sidwell  <nathan@codesourcery.com>
+
+       PR c++/17431
+       * g++.dg/overload/arg1.C: New.
+       * g++.dg/overload/arg2.C: New.
+       * g++.dg/overload/arg3.C: New.
+       * g++.dg/overload/arg4.C: New.
+
 2004-11-30  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.c-torture/execute/20041126-1.c: New test.