]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/13907 (valid conversion rejected unless -pedantic is set)
authorGabriel Dos Reis <gdr@integrable-solutions.net>
Sun, 22 Feb 2004 16:05:49 +0000 (16:05 +0000)
committerGabriel Dos Reis <gdr@gcc.gnu.org>
Sun, 22 Feb 2004 16:05:49 +0000 (16:05 +0000)
    Backport from mainline
    2004-02-02  Mark Mitchell  <mark@codesourcery.com>
    PR c++/13907
    * call.c (convert_class_to_reference): Keep better track of
    pedantically invalid user-defined conversions.

From-SVN: r78263

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/conversion/op2.C

index eb0f336d880dc74ab11362c48e85a7c6b3767398..4415bda7aa70de982e48997e9191218385bf140e 100644 (file)
@@ -1,3 +1,11 @@
+2004-02-22  Gabriel Dos Reis  <gdr@integrable-solutions.net>
+
+       Backport from mainline
+       2004-02-02  Mark Mitchell  <mark@codesourcery.com>
+       PR c++/13907
+       * call.c (convert_class_to_reference): Keep better track of
+       pedantically invalid user-defined conversions.
+
 2004-02-14  Release Manager
 
        * GCC 3.3.3 Released.
index ce90678659942a4dae52e8da933b53e9f8f27f88..89fc25790f24e12939917173ca42dfa047d3ef58 100644 (file)
@@ -1091,15 +1091,19 @@ convert_class_to_reference (t, s, expr)
                                           LOOKUP_NORMAL);
          
          if (cand)
-           /* Build a standard conversion sequence indicating the
-              binding from the reference type returned by the
-              function to the desired REFERENCE_TYPE.  */
-           cand->second_conv
-             = (direct_reference_binding 
-                (reference_type, 
-                 build1 (IDENTITY_CONV, 
-                         TREE_TYPE (TREE_TYPE (TREE_TYPE (cand->fn))),
-                         NULL_TREE)));
+            {
+              /* Build a standard conversion sequence indicating the
+                 binding from the reference type returned by the
+                 function to the desired REFERENCE_TYPE.  */
+              cand->second_conv
+                = (direct_reference_binding 
+                   (reference_type, 
+                    build1 (IDENTITY_CONV, 
+                            TREE_TYPE (TREE_TYPE (TREE_TYPE (cand->fn))),
+                            NULL_TREE)));
+              ICS_BAD_FLAG (cand->second_conv)
+                |= ICS_BAD_FLAG (TREE_VEC_ELT (cand->convs, 0));
+            }
        }
       conversions = TREE_CHAIN (conversions);
     }
index b400988108d28634a21178630c9c06a9931b4e0a..d31896f23b623d58bc51e6737c70d53d8f2e5271 100644 (file)
@@ -5,10 +5,8 @@ struct A {
   operator const int & () const;
 };
                                                                                
-          
 void f(int &);
 void f(const int &);
-                                                                               
           
 int main() {
   const A x = A();