This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/38622] operator ?: Does not check identity of types
- From: "lisp2d at lisp2d dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Dec 2008 14:36:56 -0000
- Subject: [Bug c++/38622] operator ?: Does not check identity of types
- References: <bug-38622-16927@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from lisp2d at lisp2d dot net 2008-12-25 14:36 -------
Let's start from the beginning.
class A{public:int x;A():x(0){};};
class B:public A{public:int y;B():A(),y(0){};};
class C:public A{public:int z;C():A(),z(0){};};
B xb;
C xc;
A& debug1(){
return (false?xb:xc);} // an error
A& debug2(){
if(false)
return xb; //good
else
return xc;} //good
It is desirable to remove an error message.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38622