public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15684] New: Pointer to member function called on incomplete type should diag
@ 2004-05-28  1:47 gianni at mariani dot ws
  2004-05-28  1:55 ` [Bug c++/15684] " gianni at mariani dot ws
                   ` (15 more replies)
  0 siblings, 16 replies; 19+ messages in thread
From: gianni at mariani dot ws @ 2004-05-28  1:47 UTC (permalink / raw)
  To: gcc-bugs

Leor Zolman posted this example on comp.lang.c++

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&selm=due8b09cd2lp3kip4ivtcrn2m3nu6jvmuu%404ax.com

It seems according to the standard that the code below is illegal.  However it
is accepted by all compilers I know of.  I verified that 3.4.0 accepts the code
below.


#include <iostream>
using std::cout;
using std::endl;

class A;

class B {
    public:
        typedef void (A::*ftype)();
        void CallIt(A *ap, ftype f)
        {
            (ap->*f)(); // Is this legal with ptr to incomplete type A?
        }
};

class A
{
    public:
        void method_for_B() {
            std::cout << "In method_for_B...()" << std::endl;
        }

};

int main()
{
    void (A::*fp)() = &A::method_for_B;
    A a1;
    B b1;
    b1.CallIt(&a1, fp);
    return 0;
}

-- 
           Summary: Pointer to member function called on incomplete type
                    should diag
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gianni at mariani dot ws
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 19+ messages in thread
[parent not found: <bug-15684-2828@http.gcc.gnu.org/bugzilla/>]
[parent not found: <bug-15684-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2021-07-16  7:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-28  1:47 [Bug c++/15684] New: Pointer to member function called on incomplete type should diag gianni at mariani dot ws
2004-05-28  1:55 ` [Bug c++/15684] " gianni at mariani dot ws
2004-05-28  2:01 ` pinskia at gcc dot gnu dot org
2004-05-28  4:00 ` leor at bdsoft dot com
2004-05-28  4:01 ` pinskia at gcc dot gnu dot org
2004-05-28 11:31 ` gianni at mariani dot ws
2004-05-28 11:57 ` pinskia at gcc dot gnu dot org
2004-05-28 12:02 ` pinskia at gcc dot gnu dot org
2004-05-28 14:46 ` leor at bdsoft dot com
2004-05-28 15:45 ` pinskia at gcc dot gnu dot org
2004-05-28 15:59 ` gianni at mariani dot ws
2004-05-28 17:01 ` leor at bdsoft dot com
2004-05-28 17:55 ` giovannibajo at libero dot it
2004-05-28 19:03 ` pinskia at gcc dot gnu dot org
2004-05-28 19:13 ` pinskia at gcc dot gnu dot org
2004-12-10 21:09 ` pinskia at gcc dot gnu dot org
2004-12-10 21:41 ` pinskia at gcc dot gnu dot org
     [not found] <bug-15684-2828@http.gcc.gnu.org/bugzilla/>
2007-06-20 13:44 ` pinskia at gcc dot gnu dot org
     [not found] <bug-15684-4@http.gcc.gnu.org/bugzilla/>
2021-07-16  7:55 ` 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).