Hello,
I have the following code that compiles with g++ (4.3.2) without any warning and runs smoothly with "-ansi -pedantic -Wall". But it does not compile with Intel C++ compiler (icc, v10.1). It again worked without issues on v11. The following is the code:
#include
using namespace std;
class Add {
private:
int dx;
public:
Add() : dx(0) {}
Add(int _dx) : dx(_dx) {}
int operator() (int n)
{
return n+dx;
}
int dee_x(int n, int tx)
{
return n+tx;
}
};
int main()
{
Add add_0;
Add add_5(5);
cout << add_0(100) << endl;
cout << add_5(100) << endl;
cout << add_0.dee_x(100,5) << endl;
return 0;
}
The error with icc (v10.1) was:
/usr/include/c++/4.3.2/bits/char_traits.h(266): error: identifier "__builtin_memchr" is undefined
{ return static_cast(__builtin_memchr(__s, __a, __n)); }
^
/usr/include/c++/4.3.2/bits/char_traits.h(270): error: identifier "__builtin_memmove" is undefined
{ return static_cast(__builtin_memmove(__s1, __s2, __n)); }
^
/usr/include/c++/4.3.2/bits/allocator.h(143): error: identifier "__is_empty" is undefined
template
^
/usr/include/c++/4.3.2/bits/allocator.h(143): error: function call is not allowed in a constant expression
template
^
/usr/include/c++/4.3.2/bits/allocator.h(143): error: type name is not allowed
template
^
/usr/include/c++/4.3.2/bits/allocator.h(160): error: identifier "__is_empty" is undefined
template
^
/usr/include/c++/4.3.2/bits/allocator.h(160): error: function call is not allowed in a constant expression
template
^
/usr/include/c++/4.3.2/bits/allocator.h(160): error: type name is not allowed
template
^
/usr/include/c++/4.3.2/bits/locale_facets.tcc(1284): error: class "std::ctype_byname" is not an entity that can be instantiated
extern template class ctype_byname;
^
/usr/include/c++/4.3.2/bits/locale_facets.tcc(1319): error: class "std::ctype_byname" is not an entity that can be instantiated
extern template class ctype_byname;
^
compilation aborted for function_objects.cpp (code 2)The same program worked with v11 without any issues. I guess there is a bug in v10.1 which seems to have been fixed. (The post is here only to report a possible bug or correct myself of some subtle mistake(s).)
TIA,
-S



