[Bug c++/38622] operator ?: Does not check identity of types
lisp2d at lisp2d dot net
gcc-bugzilla@gcc.gnu.org
Thu Dec 25 05:43:00 GMT 2008
------- Comment #4 from lisp2d at lisp2d dot net 2008-12-25 05:41 -------
If commands if and ?: operate on a miscellaneous.
Not clearly when works copyconstructor and when there is no.
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){};};
A debug0(){
A xa;
B xb;
return (false?xa:xb);} //good
A debug1(){
C xc;
B xb;
return (false?xc:xb);} //error
A debug2(){
C xc;
B xb;
if(false)
return xc; //good
else
return xb;} //good
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38622
More information about the Gcc-bugs
mailing list