public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26698]  New: g++ accepts const-incorrect code due to conversion function
@ 2006-03-15 16:10 jkherciueh at gmx dot net
  2006-03-15 16:19 ` [Bug c++/26698] " pinskia at gcc dot gnu dot org
                   ` (19 more replies)
  0 siblings, 20 replies; 21+ messages in thread
From: jkherciueh at gmx dot net @ 2006-03-15 16:10 UTC (permalink / raw)
  To: gcc-bugs

/*
  The following piece of code should not compile:

  According to [12.3.2/1], the conversion function
  operator X&() cannot be called. However, its
  presence tricks the compiler into thinking that
  I has a license to initialize a non-const X& from a
  const X&. This is illegal by [8.5.3/5].

  I think that diagnostics is required in this case.

  Instead, g++ compiles this code, but the program
  segfaults.
*/

struct X {

  int x;

  X ( int i = 0 )
    : x ( i )
  {}

  operator X & ( void ) const {
    return ( *this );
  }

};

void add_one ( X & ref ) {
  ++ ref.x;
}

#include <iostream>

int main ( void ) {
  X const a ( 2 );
  add_one( a );
  std::cout << a.x << '\n';
}


-- 
           Summary: g++ accepts const-incorrect code due to conversion
                    function
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jkherciueh at gmx dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
@ 2006-03-15 16:19 ` pinskia at gcc dot gnu dot org
  2006-05-26 15:37 ` bangerth at dealii dot org
                   ` (18 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-03-15 16:19 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-03-15 16:19 -------
Hmm, we used to get a warning in 3.2.3 and before:
t.cc:9: warning: conversion to a reference to the same type will never use a 
   type conversion operator

And it was rejected in 2.95.3:
t.cc:9: warning: conversion to a reference to the same type will never use a
type conversion operator
t.cc:9: warning: conversion to a reference to the same type will never use a
type conversion operator
t.cc: In method `X::operator X &() const':
t.cc:10: conversion from `const X' to `X &' discards qualifiers
t.cc: In function `int main()':
t.cc:23: conversion from `const X' to `X &' discards qualifiers
t.cc:15: in passing argument 1 of `add_one(X &)'


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
  2006-03-15 16:19 ` [Bug c++/26698] " pinskia at gcc dot gnu dot org
@ 2006-05-26 15:37 ` bangerth at dealii dot org
  2006-09-16  1:48 ` lopezibanez at gmail dot com
                   ` (17 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: bangerth at dealii dot org @ 2006-05-26 15:37 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from bangerth at dealii dot org  2006-05-26 15:37 -------
Confirmed. We should not be calling the conversion operator.
W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2006-05-26 15:37:05
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
  2006-03-15 16:19 ` [Bug c++/26698] " pinskia at gcc dot gnu dot org
  2006-05-26 15:37 ` bangerth at dealii dot org
@ 2006-09-16  1:48 ` lopezibanez at gmail dot com
  2006-09-16 21:14 ` lopezibanez at gmail dot com
                   ` (16 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: lopezibanez at gmail dot com @ 2006-09-16  1:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from lopezibanez at gmail dot com  2006-09-16 01:48 -------
When using -Wconverson:

pr26698.cpp:24: warning: conversion to a reference to the same type will never
use a type conversion operator

Maybe this warning should be reported always?


-- 

lopezibanez at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lopezibanez at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (2 preceding siblings ...)
  2006-09-16  1:48 ` lopezibanez at gmail dot com
@ 2006-09-16 21:14 ` lopezibanez at gmail dot com
  2006-09-16 21:34 ` lopezibanez at gmail dot com
                   ` (15 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: lopezibanez at gmail dot com @ 2006-09-16 21:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from lopezibanez at gmail dot com  2006-09-16 21:14 -------
The change was made on revision 110567 on gcc/cp/decl.c

@@ -9012,7 +9011,7 @@
            }

          if (what)
-           warning (0, "conversion to %s%s will never use a type "
+           warning (OPT_Wconversion, "conversion to %s%s will never use a type
"
                     "conversion operator",
                     ref ? "a reference to " : "", what);
        }


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (3 preceding siblings ...)
  2006-09-16 21:14 ` lopezibanez at gmail dot com
@ 2006-09-16 21:34 ` lopezibanez at gmail dot com
  2006-09-16 21:50 ` [Bug c++/26698] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
                   ` (14 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: lopezibanez at gmail dot com @ 2006-09-16 21:34 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from lopezibanez at gmail dot com  2006-09-16 21:34 -------
Actually, it seems that the conditional on Wconversion was added before, at
revision 100541 by mmitchel (Notice the warn_conversion flag below).


@@ -8755,32 +8755,38 @@
       if (operator_code == CALL_EXPR)
        return;

-      if (IDENTIFIER_TYPENAME_P (name) && ! DECL_TEMPLATE_INFO (decl))
+      /* Warn about conversion operators that will never be used.  */
+      if (IDENTIFIER_TYPENAME_P (name)
+         && ! DECL_TEMPLATE_INFO (decl)
+         && warn_conversion
+         /* Warn only declaring the function; there is no need to
+            warn again about out-of-class definitions.  */
+         && class_type == current_class_type)
        {
          tree t = TREE_TYPE (name);
-         if (! friendp)
-           {
-             int ref = (TREE_CODE (t) == REFERENCE_TYPE);
-             const char *what = 0;
+         int ref = (TREE_CODE (t) == REFERENCE_TYPE);
+         const char *what = 0;

-             if (ref)
-               t = TYPE_MAIN_VARIANT (TREE_TYPE (t));
+         if (ref)
+           t = TYPE_MAIN_VARIANT (TREE_TYPE (t));

-             if (TREE_CODE (t) == VOID_TYPE)
-               what = "void";
-             else if (t == current_class_type)
+         if (TREE_CODE (t) == VOID_TYPE)
+           what = "void";
+         else if (class_type)
+           {
+             if (t == class_type)
                what = "the same type";
              /* Don't force t to be complete here.  */
              else if (IS_AGGR_TYPE (t)
                       && COMPLETE_TYPE_P (t)
-                      && DERIVED_FROM_P (t, current_class_type))
+                      && DERIVED_FROM_P (t, class_type))
                what = "a base class";
+           }

-             if (what && warn_conversion)
-               warning (0, "conversion to %s%s will never use a type "
-                         "conversion operator",
-                        ref ? "a reference to " : "", what);
-           }
+         if (what)
+           warning (0, "conversion to %s%s will never use a type "
+                    "conversion operator",
+                    ref ? "a reference to " : "", what);
        }
       if (operator_code == COND_EXPR)
        {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (4 preceding siblings ...)
  2006-09-16 21:34 ` lopezibanez at gmail dot com
@ 2006-09-16 21:50 ` pinskia at gcc dot gnu dot org
  2006-09-20 21:58 ` mmitchel at gcc dot gnu dot org
                   ` (13 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-09-16 21:50 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |10915
      Known to work|                            |2.95.3
            Summary|g++ accepts const-incorrect |[4.0/4.1/4.2 Regression] g++
                   |code due to conversion      |accepts const-incorrect code
                   |function                    |due to conversion function
   Target Milestone|---                         |4.0.4


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (5 preceding siblings ...)
  2006-09-16 21:50 ` [Bug c++/26698] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
@ 2006-09-20 21:58 ` mmitchel at gcc dot gnu dot org
  2007-02-03 16:25 ` [Bug c++/26698] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
                   ` (12 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2006-09-20 21:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (6 preceding siblings ...)
  2006-09-20 21:58 ` mmitchel at gcc dot gnu dot org
@ 2007-02-03 16:25 ` gdr at gcc dot gnu dot org
  2007-02-03 17:27 ` jsm28 at gcc dot gnu dot org
                   ` (11 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: gdr at gcc dot gnu dot org @ 2007-02-03 16:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from gdr at gcc dot gnu dot org  2007-02-03 16:24 -------
Won't fix in GCC-4.0.x.  Adjustine milestone.


-- 

gdr at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.4                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (7 preceding siblings ...)
  2007-02-03 16:25 ` [Bug c++/26698] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
@ 2007-02-03 17:27 ` jsm28 at gcc dot gnu dot org
  2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
                   ` (10 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2007-02-03 17:27 UTC (permalink / raw)
  To: gcc-bugs



-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.2


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (8 preceding siblings ...)
  2007-02-03 17:27 ` jsm28 at gcc dot gnu dot org
@ 2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
  2007-09-07  0:34 ` pcarlini at suse dot de
                   ` (9 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-02-14  9:10 UTC (permalink / raw)
  To: gcc-bugs



-- 

mmitchel at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.1.2                       |4.1.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (9 preceding siblings ...)
  2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
@ 2007-09-07  0:34 ` pcarlini at suse dot de
  2007-09-07  0:36 ` pcarlini at suse dot de
                   ` (8 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pcarlini at suse dot de @ 2007-09-07  0:34 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]



------- Comment #7 from pcarlini at suse dot de  2007-09-07 00:34 -------
Now in mainline things are better:

26698.C: In member function ‘X::operator X&() const’:
26698.C:25: error: invalid initialization of reference of type ‘X&’ from
expression of type ‘const X’

I'm not sure whether an error at line 28 is mandatory together with the above
one.


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pcarlini at suse dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (10 preceding siblings ...)
  2007-09-07  0:34 ` pcarlini at suse dot de
@ 2007-09-07  0:36 ` pcarlini at suse dot de
  2007-09-07  0:39 ` pcarlini at suse dot de
                   ` (7 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pcarlini at suse dot de @ 2007-09-07  0:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pcarlini at suse dot de  2007-09-07 00:36 -------
Mark?


-- 

pcarlini at suse dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (11 preceding siblings ...)
  2007-09-07  0:36 ` pcarlini at suse dot de
@ 2007-09-07  0:39 ` pcarlini at suse dot de
  2007-09-07 23:50 ` mmitchel at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pcarlini at suse dot de @ 2007-09-07  0:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from pcarlini at suse dot de  2007-09-07 00:39 -------
Meant line *38* of course, sorry.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (12 preceding siblings ...)
  2007-09-07  0:39 ` pcarlini at suse dot de
@ 2007-09-07 23:50 ` mmitchel at gcc dot gnu dot org
  2007-10-02 15:47 ` pcarlini at suse dot de
                   ` (5 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2007-09-07 23:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from mmitchel at gcc dot gnu dot org  2007-09-07 23:50 -------
It looks to me that the change I made in Comment #5 was just an optimization;
the warning was already conditionalized on warn_conversion.  I just
short-circuited the checking sooner.  Declaring the conversion function is not
illegal, so I think it's OK that we only warn conditionally.

It's true that we should never use the conversion function.  The error we're
getting now is just a consequence of the body of the conversion function; if we
put "return *new X" in there, it would compile file, and we probably wouldn't
get an error about the program, even though it's still invalid.

So, I do think that there's a bug somewhere; we shouldn't be considering this
conversion operator when calling add_one.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (13 preceding siblings ...)
  2007-09-07 23:50 ` mmitchel at gcc dot gnu dot org
@ 2007-10-02 15:47 ` pcarlini at suse dot de
  2007-10-07 19:50 ` patchapp at dberlin dot org
                   ` (4 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: pcarlini at suse dot de @ 2007-10-02 15:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #11 from pcarlini at suse dot de  2007-10-02 15:47 -------
By the way, confirmed the "return *new X" point.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (14 preceding siblings ...)
  2007-10-02 15:47 ` pcarlini at suse dot de
@ 2007-10-07 19:50 ` patchapp at dberlin dot org
  2007-10-12 18:43 ` simartin at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: patchapp at dberlin dot org @ 2007-10-07 19:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #12 from patchapp at dberlin dot org  2007-10-07 19:50 -------
Subject: Bug number PR c++/26698

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-10/msg00379.html


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (15 preceding siblings ...)
  2007-10-07 19:50 ` patchapp at dberlin dot org
@ 2007-10-12 18:43 ` simartin at gcc dot gnu dot org
  2007-10-13  6:05 ` simartin at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  19 siblings, 0 replies; 21+ messages in thread
From: simartin at gcc dot gnu dot org @ 2007-10-12 18:43 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #13 from simartin at gcc dot gnu dot org  2007-10-12 18:43 -------
Subject: Bug 26698

Author: simartin
Date: Fri Oct 12 18:43:33 2007
New Revision: 129274

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129274
Log:
gcc/cp/

2007-10-12  Simon Martin  <simartin@users.sourceforge.net>

        PR c++/26698
        * call.c (build_user_type_conversion_1): Do not consider conversion
        functions to convert a (possibly cv-qualified) object to the (possibly
        cv-qualified) same object type (or a reference to it), to a (possibly
        cv-qualified) base class of that type (or a reference to it).

gcc/testsuite/

2007-10-12  Simon Martin  <simartin@users.sourceforge.net>

        PR c++/26698
        * g++.dg/conversion/op4.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/conversion/op4.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/call.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (16 preceding siblings ...)
  2007-10-12 18:43 ` simartin at gcc dot gnu dot org
@ 2007-10-13  6:05 ` simartin at gcc dot gnu dot org
  2007-10-13  6:17 ` simartin at gcc dot gnu dot org
  2008-08-21 12:06 ` paolo dot carlini at oracle dot com
  19 siblings, 0 replies; 21+ messages in thread
From: simartin at gcc dot gnu dot org @ 2007-10-13  6:05 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #14 from simartin at gcc dot gnu dot org  2007-10-13 06:05 -------
Subject: Bug 26698

Author: simartin
Date: Sat Oct 13 06:04:57 2007
New Revision: 129282

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129282
Log:
gcc/cp/

2007-10-13  Simon Martin  <simartin@users.sourceforge.net>

        PR c++/26698
        * call.c (build_user_type_conversion_1): Do not consider conversion
        functions to convert a (possibly cv-qualified) object to the (possibly
        cv-qualified) same object type (or a reference to it), to a (possibly
        cv-qualified) base class of that type (or a reference to it).

gcc/testsuite/

2007-10-13  Simon Martin  <simartin@users.sourceforge.net>

        PR c++/26698
        * g++.dg/conversion/op4.C: New test.

Added:
    branches/gcc-4_2-branch/gcc/testsuite/g++.dg/conversion/op4.C
Modified:
    branches/gcc-4_2-branch/gcc/cp/ChangeLog
    branches/gcc-4_2-branch/gcc/cp/call.c
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (17 preceding siblings ...)
  2007-10-13  6:05 ` simartin at gcc dot gnu dot org
@ 2007-10-13  6:17 ` simartin at gcc dot gnu dot org
  2008-08-21 12:06 ` paolo dot carlini at oracle dot com
  19 siblings, 0 replies; 21+ messages in thread
From: simartin at gcc dot gnu dot org @ 2007-10-13  6:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #15 from simartin at gcc dot gnu dot org  2007-10-13 06:17 -------
Fixed on all the active branches.


-- 

simartin at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function
  2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
                   ` (18 preceding siblings ...)
  2007-10-13  6:17 ` simartin at gcc dot gnu dot org
@ 2008-08-21 12:06 ` paolo dot carlini at oracle dot com
  19 siblings, 0 replies; 21+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-08-21 12:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #16 from paolo dot carlini at oracle dot com  2008-08-21 12:04 -------
*** Bug 36430 has been marked as a duplicate of this bug. ***


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |gbrammer at gmx dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26698


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2008-08-21 12:06 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-15 16:10 [Bug c++/26698] New: g++ accepts const-incorrect code due to conversion function jkherciueh at gmx dot net
2006-03-15 16:19 ` [Bug c++/26698] " pinskia at gcc dot gnu dot org
2006-05-26 15:37 ` bangerth at dealii dot org
2006-09-16  1:48 ` lopezibanez at gmail dot com
2006-09-16 21:14 ` lopezibanez at gmail dot com
2006-09-16 21:34 ` lopezibanez at gmail dot com
2006-09-16 21:50 ` [Bug c++/26698] [4.0/4.1/4.2 Regression] " pinskia at gcc dot gnu dot org
2006-09-20 21:58 ` mmitchel at gcc dot gnu dot org
2007-02-03 16:25 ` [Bug c++/26698] [4.0/4.1/4.2/4.3 " gdr at gcc dot gnu dot org
2007-02-03 17:27 ` jsm28 at gcc dot gnu dot org
2007-02-14  9:10 ` mmitchel at gcc dot gnu dot org
2007-09-07  0:34 ` pcarlini at suse dot de
2007-09-07  0:36 ` pcarlini at suse dot de
2007-09-07  0:39 ` pcarlini at suse dot de
2007-09-07 23:50 ` mmitchel at gcc dot gnu dot org
2007-10-02 15:47 ` pcarlini at suse dot de
2007-10-07 19:50 ` patchapp at dberlin dot org
2007-10-12 18:43 ` simartin at gcc dot gnu dot org
2007-10-13  6:05 ` simartin at gcc dot gnu dot org
2007-10-13  6:17 ` simartin at gcc dot gnu dot org
2008-08-21 12:06 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).