This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/26698] [4.0/4.1/4.2/4.3 Regression] g++ accepts const-incorrect code due to conversion function



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]