This is the mail archive of the cygwin@sourceware.cygnus.com
mailing list for the Cygwin project. See the Cygwin
home page for more information.
[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]
This C++ code fails
- To: <cygwin@sourceware.cygnus.com>
- Subject: This C++ code fails
- From: "Ian Farquharson" <ifarquha@ihug.co.nz>
- Date: Tue, 16 Mar 1999 00:07:20 +1300
- Delivered-To: listarch-cygwin@sourceware.cygnus.com
- Delivered-To: mailing list cygwin@sourceware.cygnus.com
- Importance: Normal
- Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
- Reply-To: <ifarquha@ihug.co.nz>
- Sender: cygwin-owner@sourceware.cygnus.com
This small test program demonstrates a problem I am having with virtual base
classes and a pointer to member.
When I try to call a function in a class that has virtual base classes
through a pointer to member the program crashes.
I have compiled and run this same test successfully under Borland C++ 5.02
I am using cygwin B20.1 with EGCS 1.1.1 installed. You can compile the test
using the command "gcc Try.cpp -o Try.exe". When the program is run I get
the following output:
bash-2.02$ gcc try.cpp -o try.exe
bash-2.02$ ./try
Calling Test1::Click directly.
void Test1::Click(void)
Calling Test1::Click through pointer to member.
void Test1::Click(void)
Calling Test2::Click directly.
void Test2::Click(void)
Calling Test2::Click through pointer to member.
[main] D:\race\test\try.exe 1016 (0) handle_exceptions: Exception:
STATUS_ACCESS
_VIOLATION
[main] try 1016 (0) handle_exceptions: Dumping stack trace to try.exe.core
The Test2 class is using virtual base classes, unlike the Test1 class. This
difference causes an exception to be thrown when the pointer to member is
used.
Any help would be much appreciated.
Try.cpp
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com