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

Possible non standard-conforming behavior of icpc

Massimiliano_Culpo
327 Views
I would like to report on a possible bug I found with the use of Expression Templates technique. A detailed description of the problem can be found here:

http://stackoverflow.com/questions/9819298/conversion-operator-implemented-with-static-cast

which is the follow-up of another thread, where you can find a piece of code that can reproduce the bug:

http://stackoverflow.com/questions/9738975/crtp-compiler-dependent-issue-with-expression-template

Regards,
Massimiliano
0 Kudos
4 Replies
TimP
Honored Contributor III
327 Views
As you seem to have a fairly complicated issue, it would be better to file a self-contained problem report on premier.intel.com. I can't even tell from that convoluted thread whether you take issue with the response you got about how to correct your issue.
0 Kudos
Massimiliano_Culpo
327 Views
The problem that was spotted has been corrected (first edit) and you can use the code that has been posted as a self-contained problem. Furthermore as the thread was getting "convoluted" I moved the core question to another thread (which is quite neat). I just want to let you know of a possible problem, and have no interest in resubmit the issue.

Have a nice day,
Massimiliano
0 Kudos
Judith_W_Intel
Employee
327 Views

I hope the example below represents your issue. I entered it into our bug tracking database as DPD200180500.

Thank you for pointing this out.

// example of infinite recursion with Intel compiler but runs ok with g++ and cl

extern "C" int printf(const char*,...);

template
struct Base {
operator const Derived&() const {
printf("in conversion operator\n");
return static_cast (*this);
}
};

class Specialization : public Base {};

template
void foo(const Base& param) {
const T& val(param);
}

int main()
{
Base b;
foo(b);
return 0;
};

Judy

0 Kudos
Massimiliano_Culpo
327 Views
Yes, that's exactly the issue I spotted.

Best regards,
Massimiliano
0 Kudos
Reply