public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/50282] New: pointer-to-member cast works incorrectly
@ 2011-09-03  7:39 imzhuli at vip dot qq.com
  2011-09-03  7:39 ` [Bug c++/50282] " imzhuli at vip dot qq.com
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: imzhuli at vip dot qq.com @ 2011-09-03  7:39 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50282
           Summary: pointer-to-member cast works incorrectly
    Classification: Unclassified
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: imzhuli@vip.qq.com


Created attachment 25180
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25180
compile-info (command line, and g++ output),  t.cpp (source), t.ii

in ISO/IEC 14882 (cpp2003) <also in n3224(cpp0x)>, chapter 5.2.10 about
reinterpret_cast, the rule 9 says:
"
An rvalue of type “pointer to member of X of type T1” can be explicitly
converted to an rvalue of type
“pointer to member of Y of type T2” if T1 and T2 are both function types or
both object types.66) The null
member pointer value (4.11) is converted to the null member pointer value of
the destination type. The
result of this conversion is unspecified, except in the following cases:
— converting an rvalue of type “pointer to member function” to a different
pointer to member function
type and back to its original type yields the original pointer to member value.
— converting an rvalue of type “pointer to data member of X of type T1” to the
type “pointer to data member
of Y of type T2” (where the alignment requirements of T2 are no stricter than
those of T1) and back
to its original type yields the original pointer to member value.
"

but as i tested using G++ 4.1.2 (SUSE LINUX 11) / G++ 4.5.5 (UBUNTU 11.04), 
this is not exactly implemented. 

detailed comments are in the attachments.

attachment:
1.compile info.txt 
2.t.ii /test-case ii file
3.tiny single test-case source-file which includes ONLY c++ standered headers,
detailed commented.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-09-05  8:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-03  7:39 [Bug c++/50282] New: pointer-to-member cast works incorrectly imzhuli at vip dot qq.com
2011-09-03  7:39 ` [Bug c++/50282] " imzhuli at vip dot qq.com
2011-09-03  8:56 ` redi at gcc dot gnu.org
2011-09-03  8:56 ` redi at gcc dot gnu.org
2011-09-03 11:32 ` imzhuli at vip dot qq.com
2011-09-03 12:01 ` rguenth at gcc dot gnu.org
2011-09-03 12:17 ` imzhuli at vip dot qq.com
2011-09-04 18:45 ` redi at gcc dot gnu.org
2011-09-05  3:13 ` imzhuli at vip dot qq.com
2011-09-05  8:09 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).