c++/2497: g++ can't parse explicit calls to template destructors

anibal@intelerad.com anibal@intelerad.com
Thu Apr 5 13:26:00 GMT 2001

>Number:         2497
>Category:       c++
>Synopsis:       g++ can't parse explicit calls to template destructors
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 05 13:26:00 PDT 2001
>Originator:     Anibal Jodorcovsky
>Release:        egcs-2.91.66
Linux RedHat 6.2
When trying to call the template destructor explicitly I get:

destructor specifier `vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,__default_alloc_template<true,0> >::~vector<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0> >,__default_alloc_template<true,0> >' must have matching names
Hl7Segment.cpp:40: parse error before `>'



where mAl1Fields is defined as:

    static vector<string> mAl1Fields;

(even if it's not static it doesn't work).

However, from a 1997 post in a mailing list I got this 

typedef vector<string> JJ;

And then calling:



Now, if this problem was found 4 years ago, and this is documented
to work on The C++ Standard Library, A Tutorial And Reference,
by Nicolai M. Josuttis on page 150 4th Edition, I would have
thought that it might have been fixed by now :-)
call destructor on a vector, i.e.,

vector<string> myVector;
None available. Workaround possible is the usage of typedef.

typedef vector<string> JJ;

JJ myVector;

More information about the Gcc-bugs mailing list