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++/38622] operator ?: Does not check identity of types



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


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