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

icpc 12.0 and gcc 4.6.#

James_Benson
Beginner
509 Views
Hello,

I recently obtained icpc 12.0 for linux at my workplace. I'm trying to get it to compile some programs that g++ 4.6.1 compiles just fine. Here is a simple test case that shows the problem:

#include

#include // for setprecision and friends
// For icpc v12.0 above include requires CPPFLAGS +=-std=c++0x

#include

using namespace std;

int main(int /*argc*/, char ** /*argv[]*/) {

vector vString;

vString.clear();

//vString.reserve(5);

}

A few minutes on google showed me the necessity for -std=c++0x if in included. The above compiles fine:

icpc -c -O0 -g -std=c++0x -w1 -Wcheck -wd654,1572,411,873,1125 -DLETTLE_ENDIAN -I/opt/qtsdk-2010.05/qt/mkspecs/linux-icc-64 -I. -I../../classlib/include -o main.o main.cpp
icpc -Wl,-rpath,/opt/qtsdk-2010.05/qt/lib -o jtest main.o -L/usr/X11R6/lib -lX11 -lm

until i uncoment the vString.reserve(5); line, then i get:

icpc -c -O0 -g -std=c++0x -w1 -Wcheck -wd654,1572,411,873,1125 -DLETTLE_ENDIAN -I/opt/qtsdk-2010.05/qt/mkspecs/linux-icc-64 -I. -I../../classlib/include -o main.o main.cpp
/usr/local/include/c++/4.6.1/bits/stl_uninitialized.h(117): error: identifier "__is_trivial" is undefined
return std::__uninitialized_copy<(__is_trivial(_ValueType1)
^
detected during:
instantiation of "_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp> &) [with _InputIterator=std::string *, _ForwardIterator=std::string *, _Tp=std::string]" at line 1056 of "/usr/local/include/c++/4.6.1/bits/stl_vector.h"
instantiation of "std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::size_t={unsigned long}, _ForwardIterator, _ForwardIterator) [with _Tp=std::string, _Alloc=std::allocator<:STRING>, _ForwardIterator=std::string *]" at line 76 of "/usr/local/include/c++/4.6.1/bits/vector.tcc"
instantiation of "void std::vector<_Tp, _Alloc>::reserve(std::size_t={unsigned long}) [with _Tp=std::string, _Alloc=std::allocator<:STRING>]" at line 16 of "main.cpp"

/usr/local/include/c++/4.6.1/bits/stl_uninitialized.h(117): error: function call is not allowed in a constant expression
return std::__uninitialized_copy<(__is_trivial(_ValueType1)
^
/usr/local/include/c++/4.6.1/bits/stl_uninitialized.h(117): error: type name is not allowed
return std::__uninitialized_copy<(__is_trivial(_ValueType1)
^
detected during:
instantiation of "_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp> &) [with _InputIterator=std::string *, _ForwardIterator=std::string *, _Tp=std::string]" at line 1056 of "/usr/local/include/c++/4.6.1/bits/stl_vector.h"
instantiation of "std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::size_t={unsigned long}, _ForwardIterator, _ForwardIterator) [with _Tp=std::string, _Alloc=std::allocator<:STRING>, _ForwardIterator=std::string *]" at line 76 of "/usr/local/include/c++/4.6.1/bits/vector.tcc"
instantiation of "void std::vector<_Tp, _Alloc>::reserve(std::size_t={unsigned long}) [with _Tp=std::string, _Alloc=std::allocator<:STRING>]" at line 16 of "main.cpp"

/usr/local/include/c++/4.6.1/bits/stl_uninitialized.h(118): error: function call is not allowed in a constant expression
&& __is_trivial(_ValueType2))>::
^
detected during:
instantiation of "_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp> &) [with _InputIterator=std::string *, _ForwardIterator=std::string *, _Tp=std::string]" at line 1056 of "/usr/local/include/c++/4.6.1/bits/stl_vector.h"
instantiation of "std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::size_t={unsigned long}, _ForwardIterator, _ForwardIterator) [with _Tp=std::string, _Alloc=std::allocator<:STRING>, _ForwardIterator=std::string *]" at line 76 of "/usr/local/include/c++/4.6.1/bits/vector.tcc"
instantiation of "void std::vector<_Tp, _Alloc>::reserve(std::size_t={unsigned long}) [with _Tp=std::string, _Alloc=std::allocator<:STRING>]" at line 16 of "main.cpp"

/usr/local/include/c++/4.6.1/bits/stl_uninitialized.h(118): error: type name is not allowed
&& __is_trivial(_ValueType2))>::
^
detected during:
instantiation of "_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp> &) [with _InputIterator=std::string *, _ForwardIterator=std::string *, _Tp=std::string]" at line 1056 of "/usr/local/include/c++/4.6.1/bits/stl_vector.h"
instantiation of "std::_Vector_base<_Tp, _Alloc>::_Tp_alloc_type::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::size_t={unsigned long}, _ForwardIterator, _ForwardIterator) [with _Tp=std::string, _Alloc=std::allocator<:STRING>, _ForwardIterator=std::string *]" at line 76 of "/usr/local/include/c++/4.6.1/bits/vector.tcc"
instantiation of "void std::vector<_Tp, _Alloc>::reserve(std::size_t={unsigned long}) [with _Tp=std::string, _Alloc=std::allocator<:STRING>]" at line 16 of "main.cpp"

compilation aborted for main.cpp (code 2)
make: *** [main.o] Error 2

Anyone know the solution to this?

Thanks!




0 Kudos
1 Solution
Alexander_W_Intel
509 Views

Hi,

I assume you are using not the latest compiler version. I can reproduce your error on an icc 12.0.3 but not on an icc 12.0.4 or 12.0.5.

So the solution would be to download the latest compiler (12.0.5) from http://registrationcenter.intel.com .

It would be nice if you leave a comment if this works for you or not.

Thanks,
Alex

View solution in original post

0 Kudos
2 Replies
Alexander_W_Intel
510 Views

Hi,

I assume you are using not the latest compiler version. I can reproduce your error on an icc 12.0.3 but not on an icc 12.0.4 or 12.0.5.

So the solution would be to download the latest compiler (12.0.5) from http://registrationcenter.intel.com .

It would be nice if you leave a comment if this works for you or not.

Thanks,
Alex

0 Kudos
James_Benson
Beginner
509 Views
Thanks Alex!
Indeed updating from the 12.0.0 version on the DVD to the latest 12.0.5 version fixed the problem.

Thanks,
Jim
0 Kudos
Reply