mirror of
https://github.com/boostorg/conversion.git
synced 2025-07-31 21:14:37 +02:00
Fixed issue from track Ticket #11209: conversion - cast_test leaks memory
This commit is contained in:
@@ -51,7 +51,8 @@ int main( int argc, char * argv[] )
|
|||||||
// test polymorphic_cast ---------------------------------------------------//
|
// test polymorphic_cast ---------------------------------------------------//
|
||||||
|
|
||||||
// tests which should succeed
|
// tests which should succeed
|
||||||
Base * base = new Derived;
|
Derived derived_instance;
|
||||||
|
Base * base = &derived_instance;
|
||||||
Base2 * base2 = 0;
|
Base2 * base2 = 0;
|
||||||
Derived * derived = 0;
|
Derived * derived = 0;
|
||||||
derived = polymorphic_downcast<Derived*>( base ); // downcast
|
derived = polymorphic_downcast<Derived*>( base ); // downcast
|
||||||
@@ -66,7 +67,8 @@ int main( int argc, char * argv[] )
|
|||||||
|
|
||||||
// tests which should result in errors being detected
|
// tests which should result in errors being detected
|
||||||
int err_count = 0;
|
int err_count = 0;
|
||||||
base = new Base;
|
Base base_instance;
|
||||||
|
base = &base_instance;
|
||||||
|
|
||||||
if ( argc > 1 && *argv[1] == '1' )
|
if ( argc > 1 && *argv[1] == '1' )
|
||||||
{ derived = polymorphic_downcast<Derived*>( base ); } // #1 assert failure
|
{ derived = polymorphic_downcast<Derived*>( base ); } // #1 assert failure
|
||||||
|
Reference in New Issue
Block a user