Author: sebor
Date: Sun Aug 28 12:44:15 2005
New Revision: 263908
URL: http://svn.apache.org/viewcvs?rev=263908&view=rev
Log:
2005-08-28 Martin Sebor <[EMAIL PROTECTED]>
STDCXX-15
* EXCEPTION_DTOR.cpp: Prevented the exception object from being
constructed and its dtor from actually being called (unless the
test is invoked with more than one command line arguments during
manual testing).
Modified:
incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp
Modified: incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp?rev=263908&r1=263907&r2=263908&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/EXCEPTION_DTOR.cpp Sun Aug 28
12:44:15 2005
@@ -60,6 +60,8 @@
#endif // _RWSTD_NO_EXCEPTION_DEFAULT_CTOR
+ // check to see if the class dtor is defined
+ // in the compiler's language support library
virtual ~exception (); // not defined here
};
@@ -79,17 +81,18 @@
{
(void)&argv;
- // try to prevent the compiler from optimizing the dtor call away
- std::exception *ptr;
+ // use dynamic allocation to prevent the compiler
+ // from optimizing the dtor call away
+ std::exception *ptr = 0;
- if (1 < argc)
+ if (2 < argc)
ptr = new Derived;
- else
+ else if (1 < argc)
ptr = new std::exception;
delete ptr;
- return !(1 < argc ? 1 == dtor : 0 == dtor);
+ return !(2 < argc ? 1 == dtor : 0 == dtor);
}
Derived::~Derived () { ++dtor; }