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 05:41:49 -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 #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