Mail Archives: djgpp/2000/02/24/18:24:24
Message-ID: | <38B599A0.9C790328@brandonsd.mb.ca>
|
From: | N J Chackowsky <chackowsky AT brandonsd DOT mb DOT ca>
|
X-Mailer: | Mozilla 4.5 [en] (Win95; I)
|
X-Accept-Language: | en
|
MIME-Version: | 1.0
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Re: Possible Compiler Bug
|
References: | <38B57379 DOT 817FFBE4 AT netcom DOT ca>
|
Lines: | 65
|
Date: | Thu, 24 Feb 2000 20:42:58 GMT
|
NNTP-Posting-Host: | 142.13.16.203
|
X-Trace: | typhoon.mbnet.mb.ca 951424978 142.13.16.203 (Thu, 24 Feb 2000 14:42:58 CST)
|
NNTP-Posting-Date: | Thu, 24 Feb 2000 14:42:58 CST
|
Organization: | MBnet Networking Inc.
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
I get the following errors, but no crash.
wrong.cpp: In method `void t::selectfunc(int)':
wrong.cpp:27: taking the address of a non-static member function
wrong.cpp:27: to form a pointer to member function, say `&t::func1'
wrong.cpp:28: taking the address of a non-static member function
wrong.cpp:28: to form a pointer to member function, say `&t::func2'
wrong.cpp:29: taking the address of a non-static member function
wrong.cpp:29: to form a pointer to member function, say `&t::func3'
wrong.cpp: In method `void t::multifunc()':
wrong.cpp:35: no matching function for call to `t::funcptr ()'
MM wrote:
>
> The file I've attached causes djgpp to kill the compiler and tell me to
> submit a full bug report. I would do so, but first I want to make sure
> this happens to others as well. If you could please take a look at the
> code and tell me what I'm doing wrong or if it shouldn't be done like
> that at all to begin with I'd greatly appreciate it.
> Thanks,
>
> ------------------------------------------------------------------------
> #include <iostream.h>
>
> class t
> {
> private:
> int a;
> public:
> t (void) : a (10) { };
>
> void selectfunc (int w);
> void multifunc (void);
> void (t::*funcptr)(void);
>
> void func1 (void);
> void func2 (void);
> void func3 (void);
> };
>
> void t::func1 (void) { cout << "Func1 " << a << endl; }
> void t::func2 (void) { cout << "Func2 " << a << endl; }
> void t::func3 (void) { cout << "Func3 " << a << endl; }
>
> void t::selectfunc (int w)
> {
> switch (w)
> {
> case 1: funcptr = &func1; break;
> case 2: funcptr = &func2; break;
> case 3: funcptr = &func3; break;
> }
> }
>
> void t::multifunc (void)
> {
> this->funcptr ();
> }
>
> int main (void)
> {
>
> return (0);
> }
- Raw text -