IBM Support

C++ Instrumentor generates uncompilable code on methods that return a template with default parameters

Troubleshooting


Problem

The IBM Rational Test RealTime C++ instrumentor might generate invalid code. This could happen when the instrumented code defines a function or method with a template class return type. The latter has one or more default parameters.

Symptom

The compiler fails to compile and generates the following errors.


a.cpp(17) : error C2065: '_Elem' : undeclared identifier
        c:\users\compileprob\src\a.cpp(12) : see reference to function template instantiation 'std::list<_Ty> A::getListTemplate<int>(const std::list<_Ty> &)' being compiled
        with
        [
            _Ty=int
        ]
a.cpp(17) : error C3203: 'allocator' : unspecialized class template can't be used as a template argument for template parameter '_Ax', expected a real type
c:\program files\microsoft visual studio 8\vc\include\list(28) : error C2825: '_Alloc': must be a class or namespace when followed by '::'
        c:\program files\microsoft visual studio 8\vc\include\list(59) : see reference to class template instantiation 'std::_List_nod<_Ty,_Alloc>' being compiled
        with
        [
            _Ty=int,
            _Alloc=int
        ]
        c:\program files\microsoft visual studio 8\vc\include\list(79) : see reference to class template instantiation 'std::_List_ptr<_Ty,_Alloc>' being compiled
        with
        [
            _Ty=int,
            _Alloc=int
        ]
        c:\program files\microsoft visual studio 8\vc\include\list(96) : see reference to class template instantiation 'std::_List_val<_Ty,_Alloc>' being compiled
        with
        [
            _Ty=int,
            _Alloc=int
        ]
        c:\program files\rational\testrealtime\targets\cvisual8\lib\routinst.h(31) : see reference to class template instantiation 'std::list<_Ty,_Ax>' being compiled
        with
        [
            _Ty=int,
            _Ax=int
        ]
       a.cpp(17) : see reference to class template instantiation '_ATO_ret_template_struct<T>' being compiled
        with
        [
            T=std::list<int,int>
        ]




[{"Product":{"code":"SSSHUF","label":"Rational Test RealTime"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"Component Testing: C++","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.0;7.0.0.1;7.0.5;7.5","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
16 June 2018

UID

swg21381059