From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25958 invoked by alias); 27 May 2004 20:49:02 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 25950 invoked by uid 48); 27 May 2004 20:49:01 -0000 Date: Fri, 28 May 2004 15:59:00 -0000 Message-ID: <20040527204901.25949.qmail@sourceware.org> From: "gianni at mariani dot ws" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20040527163621.15684.gianni@mariani.ws> References: <20040527163621.15684.gianni@mariani.ws> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c++/15684] Pointer to member function called on incomplete type should diag X-Bugzilla-Reason: CC X-SW-Source: 2004-05/txt/msg03321.txt.bz2 List-Id: ------- Additional Comments From gianni at mariani dot ws 2004-05-27 20:48 ------- About Leor's citation on virtual's being difficult. It seems like it's not so hard after all. BTW I also tried this example where B::CallIt was in a different translation unit and it all worked fine. So, while I can agree that you might need different implementation for pointer to virtual member function and regular member functions, it seems like gcc at least has no such issue. (tested on 3.4.0). #include 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: virtual void method_for_B() { std::cout << "A In method_for_B...()" << std::endl; } }; class AX : public A { public: virtual void method_for_B() { std::cout << "AX In method_for_B...()" << std::endl; } }; int main() { void (A::*fp)() = &A::method_for_B; AX a1; B b1; b1.CallIt(&a1, fp); return 0; } oh - here is the link again, hopefully without wrapping http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&c2coff=1&threadm=3ACC2828.45CA0D3C%40dresdner-bank.com&rnum=1&prev=/groups%3Fq%3Dg:thl1416673164d%26dq%3D%26hl%3Den%26lr%3D%26ie%3DUTF-8%26c2coff%3D1%26selm%3D3ACC2828.45CA0D3C%2540dresdner-bank.com -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15684