icpc 13 and gcc 4.7 c++11 mode problem

icpc 13 and gcc 4.7 c++11 mode problem

I recently updated to Composer XE 2013 which claims to support GCC 4.7. But there are many problems. For example the simple example below, which triggers the move assignment operator


int main () {

std::vector bar(10);

bar = std::vector(10);

return 0;


when compile on Linux with GCC4.7.1 installed as default GCC, it emits the following error,

$ icpc -std=c++11 -o foo foo.cpp

$ icpc -std=c++11 -o foo foo.cpp && ./foo
/opt/gcc/bin/../include/c++/4.7.1/bits/stl_vector.h(433): error: expression must have a constant value
integral_constant<bool, __move_storage>());

/opt/gcc/bin/../include/c++/4.7.1/bits/stl_vector.h(432): error: more than one instance of overloaded function "std::vector<_Tp, _Alloc>::_M_move_assign [with _Tp=double, _Alloc=std::allocator<double>]" matches the argument list:
function "std::vector<_Tp, _Alloc>::_M_move_assign(std::vector<_Tp, _Alloc> &&, std::true_type) [with _Tp=double, _Alloc=std::allocator<double>]"
function "std::vector<_Tp, _Alloc>::_M_move_assign(std::vector<_Tp, _Alloc> &&, std::false_type) [with _Tp=double, _Alloc=std::allocator<double>]"
argument types are: (std::vector<double, std::allocator<double>>, std::integral_constant<bool, <error-constant>>)
detected during instantiation of "std::vector<_Tp, _Alloc> &std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc> &&) [with _Tp=double, _Alloc=std::allocator<double>]" at line 7 of "foo.cpp"

compilation aborted for foo.cpp (code 2)

It seems to be a problem related to icpc's partial support of constexpr. The __move_storage above is defined as constexpr in the std_vector.h header, which shall be valid for template parameter.

Another problem I found earlier today is http://software.intel.com/en-us/forums/topic/326830

They both seems related to the constexpr issue. Undefine __GXX_EXPERIMENTAL_CXX0X__ solves the problem. Shouldn't icpc disable this macro by default for GCC4.7?

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I assume in your example you mean std::vector not std::vector.

I was able to reproduce the problem and created this small test case with compiles with g++ in -std=c++0x but not icpc.
There really is only one problem here, what you are seeing are cascading errors from this one problem.

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

struct integral_constant {};

typedef integral_constant true_type;

struct vector
static constexpr bool foo3() { return true; }
void foo2(true_type) { printf("PASSED\n"); }
void foo()
constexpr bool __move_storage = vector::foo3();

int main () {
vector v;
return 0;

The problem seems to be with our implementation of constexpr when using them in nontype template parameter variables.
I have entered this in our bug tracking database as DPD200236356. We will implement a fix for this ASAP.

thank you for reporting this defect to us.

This issue has been fixed in the 13.0 update 1 and later.


Hi, I am using icpc 13.1.3 20130607. I see exactly same issue mentioned above. Does Intel fix it in 13.1.3? 

Leave a Comment

Please sign in to add a comment. Not a member? Join today