[ 
https://issues.apache.org/jira/browse/STDCXX-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13201788#comment-13201788
 ] 

Travis Vitek commented on STDCXX-1055:
--------------------------------------

Stefan,

I can most definitely tell if the base class destructor is virtual or not. 
Invoking a function (including the destructor) via base class pointer or 
reference will invoke the derived class version of that function if it is 
virtual. This is the basis for polymorphism in C++, and that is exactly what my 
testcase does.

My test shows two things.

# Other implementations of the C++ Standard Library don't have virtual 
destructors for these classes.
# If someone were to write a class deriving from {{time_base}}, and their code 
relied on {{time_base}} having a virtual destructor, the destructor for their 
derived class may not get called (if it is deleted via a base class pointer).

As for making the destructors protected, I think Martin will agree (eventually) 
that they should be (he did supply the testcase and fix for STDCXX-469 for a 
similar issue in {{std::locale::facet}}). The issues that we are currently 
quibbling over is where in the inheritance tree the destructor is supposed to 
be virtual and how to create a testcase that is well-formed and can verify that 
the destructors in the derived classes are protected and not public or private.
                
> some of the localization class declarations do not follow the 
> ISO/IEC:14882:2003 specification
> ----------------------------------------------------------------------------------------------
>
>                 Key: STDCXX-1055
>                 URL: https://issues.apache.org/jira/browse/STDCXX-1055
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: 22. Localization
>    Affects Versions: 4.2.1, 4.2.2, 4.2.x, 4.3.x, 5.0.0
>         Environment: Solaris 10 and 11, Linux (RedHat and OpenSUSE), Sun C++ 
> Compiler 12.1, 12.2, 12.3, GCC4.
> The defect is independent of platform or compiler.
>            Reporter: Stefan Teleman
>              Labels: conformance, standards
>             Fix For: 4.2.x, 4.3.x, 5.0.0
>
>         Attachments: stdcxx-1055.patch
>
>
> For the following classes:
> std::codecvt<> and its specializations
> std::collate<> and its specializations
> std::ctype<> and its specializations
> std::ctype_byname<> and its specializations
> std::messages<> and its specializations
> std::messages_byname<> and its specializations
> std::money_get<> and its specializations
> std::moneypunct<> and is specializations
> std::moneypunct_byname<> and its specializations
> std::money_put<> and its specializations
> std::num_get<> and its specializations
> std::numpunct<> and its specializations
> std::numpunct_byname<> and its specializations
> std::num_put<> and its specializations
> std::time_get<> and its specializations
> std::time_get_byname<> and its specializations
> std::time_put<> and its specializations
> 1. all these type declarations must be of class type (and not of struct type)
> 2. all these classes must have protected virtual destructors
> 3. all the corresponding *_base (time_base, money_base, etc), must have 
> virtual destructors
> The current implementation of these types as structs (with default public 
> access
> specifier on their non-virtual destructors) causes failures in Perennial 
> CPPVS V8.1.
> Changing the access specifier for these destructors requires some changes in 
> the
> stdcxx tests for localization.
> Patch based on 4.2.1 to follow shortly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to