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++/13881] [3.3 Regression] Allow comparison between unrelated pointer-to-data-members


------- Additional Comments From giovannibajo at libero dot it  2004-01-29 03:37 -------
You seem confused on the subject. "A C::*" and "B C::*" are totally unrelated 
types. The default conversion could be applied if, e.g., you were to 
compare "int B::*" and "int A::*", because A is an un-ambigous non-virtual 
accessible base class of B, so the latter pointer can be converted to the 
former type. Notice the direction that the conversion follows is the opposite 
of that of normal pointers: in fact, every member of A is also a member of B, 
so every "int A::*" is also a valid "int B::*". Instead, if you have a 
generic "int B::*" you can't say for sure that it points to a member of A.

Look into [conv.mem]/2 in the ISO C++ Standard for further clarifications.


3.4/mainline follows the right behaviour, while the bug is still present on the 
3.3 branch. Maybe we can pinpoint and backport the patch that fixed it.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |3.3.3
      Known to work|                            |3.4.0 3.5.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-01-29 03:37:26
               date|                            |
            Summary|pointer-to-data-member:     |[3.3 Regression] Allow
                   |rejects cast but allows     |comparison between unrelated
                   |comparision                 |pointer-to-data-members
   Target Milestone|---                         |3.3.3


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13881


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