Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Unresolved symbols after upgrading to C++ compiler 14.0

Jean-michel_Rouet
474 Views

Dear All,

 

Since I updated to Intel Composer 14.0 (ie 13.0 SP1, and even SP1 update 1) I do have some code which do not link any more.
Although the code work ok with every other compiler I know of.

Here is an exerpt to reproduce my issue. The following code does nothing meaningful here, it is purely illustrative, so don't try to remove useless templates.

    struct Base
    {
        static const int mCount = 0;
        virtual int  GetCount() const {return 0;}
    };
 
    class A
    {
        template<typename T> 
        class Items 
        { 
        public: 
            template <int ID> struct Prop {};
            template <>  struct Prop<0> : public Base
            { 
                static const int mCount = Base::mCount+1;
                int parA;
 
                Prop() : parA(0) {} 
                int GetCount() const { return this->mCount;} 
            };
        };
 
 
    public:
        struct ParsStruct : public Items<int>::Prop<0> {};
 
        ParsStruct* mPars;
        A() : mPars(new ParsStruct()) {}
    };
 
 
    int main(int argc, const char *argv[])
    {
        A a;
        a.mPars->parA = 1;
        return 0;
    }

 

 

At link time, I get unresolved symbols on A::Items<int>::Prop<0>::Getcount(void) const like:
error LNK2001: unresolved external symbol "public: virtual int __thiscall A::Items<int>::Prop<0>::GetCount(void)const " (?GetCount@?$Prop@$0A@@?$Items@H@A@@UBEHXZ)

Although the metod is clearly defined. the specialized class Prop<0> is also dfined and Items<int>::Prop<0> explicitely used.
Can some guru explain me what has changed between Composer XE 13.0 and 14.0, such that this code links correctly in the old version and not in the new one ?

Any hint ? Is it a compiler bug or a feature ?

Very best regards,

Jean-Michel

 

0 Kudos
4 Replies
Jean-michel_Rouet
474 Views

Sorry for the badly formated initial message. The carriage returns were not interpreted as expected...

 

Meanwhile, I found a workaround to my issue. It seems that explicit specialization of the Prop<int ID> class within a class (i.e. not at the namespace scope) it not allowed by the C++ standard. When I reorganise the code to change this (using partial specialization), it compiles and links correctly.
 

However, if explicit specialization was realy the issue, it should have been a compilation issue rather than a link issue, right ?

 

0 Kudos
Judith_W_Intel
Employee
474 Views

 

This should compile and link successfully on our Windows platform since Microsoft allows this non standard specialization.

You are right this broke in 14.0.

I have submitted a bug in our bug tracking system (DPD200250257) for this defect. Thank you for reporting it.

Judy

0 Kudos
Jean-michel_Rouet
474 Views

Hi Judith,

 

Where can I follow the status of this bug ? Is your bug tracking system public ?

Best regards,
Jean-Michel.

 

Judith Ward (Intel) wrote:

 

This should compile and link successfully on our Windows platform since Microsoft allows this non standard specialization.

You are right this broke in 14.0.

I have submitted a bug in our bug tracking system (DPD200250257) for this defect. Thank you for reporting it.

Judy

0 Kudos
TimP
Honored Contributor III
474 Views

If you submit bugs yourself using your support account, this should improve your chance of seeing progress reports.  You could submit the bug now and quote the DPD number.

0 Kudos
Reply