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] |
I've been trying to compile a version of the Microsoft MFC library
with the g++ compiler and have run into a problem that I don't know
how to resolve.
Here is a highly condensed test file that shows the problem.
--------------------------------------------
1
2 class
CCmdTarget;
3 class
CWnd;
4 class
CRecordView;
5
6 typedef
int (CCmdTarget::*PMSG)(int);
7
8 class
CCmdTarget {};
9
10
11 class
CWnd : public CCmdTarget
12 {
13
public:
14
int OnMove (int x, int y);
15 };
16
17
18 class
CRecordView : public CWnd
19 {
20
public:
21
int OnMove (int);
22
protected:
23
void OnMove (int cx, int cy);
24
private:
25
static const PMSG _messageEntries[];
26 };
27
28
29 ////////////////////////////////////////////////////////////
30
31 const
PMSG CRecordView::_messageEntries[] =
32 {
33
(PMSG)&CRecordView::OnMove
34 };
----------------------------------------
If I compile the above with the Sun CC compiler, I get no complaints
or warnings. When I compile it with g++ (gcc version 2.95.2
19991024
(release)) I get the following error messages:
t.C:34: no matches
converting function `OnMove' to type `int (CCmdTarget::*)(int)'
t.C:21: candidates
are: int CRecordView::OnMove(int)
t.C:23:
void CRecordView::OnMove(int, int)
If I comment out the overloaded function declaration at line 23, it
will compile
with no errors.
The compiler appears to be ignoring the cast operator at line 33 when
it determines
the function signature or there is a problem because of the downcasting
of the function
class.
Is there a way to fix this without making major changes to the source
files (I don't understand
the MFC library well enough to make changes to it)?
Thank you,
Don Mies
-- This e-mail contains information intended only for the use of the individual or entity named above. If the reader of this e-mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, any dissemination, publication or copy of this e-mail is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender. Thank you.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |