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

ICC 12.1 Compile Error

indigoh
Beginner
1,558 Views

In building our code with ICC 12.1, we are getting a compiler error with the GCC header file for deque. The problem does not occur with ICC 11 and does not depend precisely on gcc 4.5.3.

icpc version: icpc (ICC) 12.1.0 20110811
gcc version: 4.5.3
command line: icpc -std=c++0x -o test test.cpp


Test code:

[bash]#include 

int main()
{
  std::deque d;
  int a; 
  d.insert(d.begin(), a);
}
[/bash]


These compiler errors are generated:

opt/gcc-4.5.3/bin/../include/c++/4.5.3/bits/deque.tcc(512): error: expected a ")"

value_type __x_copy(std::forward<_Args>(__args)...); // XXX copy

^

detected during:

instantiation of "std::_Deque_base<_Tp, _Alloc>::iterator std::deque<_Tp, _Alloc>::_M_insert_aux(std::_Deque_base<_Tp, _Alloc>::iterator, _Args &&...) [with _Tp=int, _Alloc=std::allocator, _Args=]" at line 136

instantiation of "std::_Deque_base<_Tp, _Alloc>::iterator std::deque<_Tp, _Alloc>::insert(std::_Deque_base<_Tp, _Alloc>::iterator, const _Tp &) [with _Tp=int, _Alloc=std::allocator]" at line 13 of "test.cpp"

/opt/gcc-4.5.3/bin/../include/c++/4.5.3/bits/deque.tcc(136): error: expected a ";"

return _M_insert_aux(__position, __x);

^

detected during instantiation of "std::_Deque_base<_Tp, _Alloc>::iterator std::deque<_Tp, _Alloc>::insert(std::_Deque_base<_Tp, _Alloc>::iterator, const _Tp &) [with _Tp=int, _Alloc=std::allocator]" at line 13 of "test.cpp"

/opt/gcc-4.5.3/bin/../include/c++/4.5.3/bits/deque.tcc(136): error: expected a "}"

return _M_insert_aux(__position, __x);

^

detected during instantiation of "std::_Deque_base<_Tp, _Alloc>::iterator std::deque<_Tp, _Alloc>::insert(std::_Deque_base<_Tp, _Alloc>::iterator, const _Tp &) [with _Tp=int, _Alloc=std::allocator]" at line 13 of "test.cpp"

compilation aborted for test.cpp (code 2)



Thanks in advance for your help.

IH.

0 Kudos
16 Replies
Judith_W_Intel
Employee
1,558 Views

I was able to reproduce the problem and have entered this into our bug database as cq #174219.
We will try to fix it as soon as possible.

This is a bug in our new 12.1 support for the C++0x feature called variadic templates.

In order to revert to 12.0 behaviour you can add -U__GXX_EXPERIMENTAL_CXX0X__ to the command line.
This will turn off the usage of variadic templatesin the GNU headers.

Thanks for reporting it.

Judy
0 Kudos
Om_S_Intel
Employee
1,558 Views
We will update the thread when the issue is fixed.
0 Kudos
Hyokun_Y_
Beginner
1,558 Views

I am having exactly the same problem with gcc 4.7.2 and icpc 13.0.1. Is this problem solved? Is there a workaround?

0 Kudos
TimP
Honored Contributor III
1,558 Views

For a workaround, you could try the suggestion earlier in the thread -U__GXX_EXPERIMENTAL_CXX0X__ if it doesn't disable other C++11 functionality you need, or look into the g++ include file where the error is reported to see if there is such a macro to disable the code which fails with icc.  It seems the same macro is present up through g++ 4.8.

If someone had shown a complete test case, we could check it, e.g. on icpc 13.0.2.

0 Kudos
Richard_Geary
Beginner
1,558 Views

At my workplace we are planning to enable c++11 in the building environment but this bug is a show stopper.  It happens to icc13.1 with gcc4.4.7 or gcc4.7.2.  It works with gcc4.1.2 which doesn't have as many c++11 features.  I don't have data point for any gcc version between 4.1 and 4.4 since we don't have any installed. I also cannot apply the workaround since it is needed in so many places in our code that the only sane solution is to undefine the macro globally.  The defeats the original purpose of enabling c++11.

My conclusion is that icc is not ready for c++11.  This would have been obvious to many others.  The long life of this issue makes me wonder that I may have been using icc incorrectly?

0 Kudos
SergeyKostrov
Valued Contributor II
1,558 Views
Are there any news / updates? >>My conclusion is that icc is not ready for c++11. This would have been obvious to many others. The long life of this issue makes >>me wonder that I may have been using icc incorrectly? I'll do a verification with Intel C++ compiler for Windows platforms and I'll report my results.
0 Kudos
SergeyKostrov
Valued Contributor II
1,558 Views
Could you try the following test-case? #include "deque" #include "algorithm" #include "iostream" using namespace std; int main( void ) { deque[arrow-left] int [arrow-right] d; int a = 777; d.insert( d.begin(), a ); for( int i = 0; i < d.size(); i++ ) cout << "d[" << i << "] = " << d << endl; return 0; } [ Output ] d[0] = 777 PS: Replace [arrow-left] int [arrow-right] to compile.
0 Kudos
SergeyKostrov
Valued Contributor II
1,558 Views
>>My conclusion is that icc is not ready for c++11... STL class deque is very old and take a look at a source file for a Copyright note ( ...1994 - 1997... ). Why did you decide that this is related to C++11 features? [ Compiler output ] Intel(R) C++ Compiler XE for applications running on IA-32, Version 12.1.3.300 Build 20120130 Copyright (C) 1985-2012 Intel Corporation. All rights reserved. Main.cpp Microsoft (R) Incremental Linker Version 8.00.50727.762 Copyright (C) Microsoft Corporation. All rights reserved. -out:Main.exe Main.obj My conclusion: I didn't have any problems with Intel(R) C++ Compiler XE Version 12.1.3.300 Build 20120130 for Windows platforms.
0 Kudos
Richard_Geary
Beginner
1,558 Views

Deque was refreshed with c++11 features.  The error I encountered is at line 588 of include/c++/4.7.2/bits/deque.tcc, which is in a block guarded by #ifdef __GXX_EXPERIMENTAL_CXX0X__. The line uses variadic template of c++11.

I attached the screen output from my redhat 5 box FYI.




0 Kudos
SergeyKostrov
Valued Contributor II
1,558 Views
>>... The error I encountered is at line 588 of include/c++/4.7.2/bits/deque.tcc... Could you attach the deque.tcc file?
0 Kudos
Richard_Geary
Beginner
1,558 Views

It is the same code as in the original post. Please see attached.

0 Kudos
Richard_Geary
Beginner
1,558 Views

Sorry thought you meant the test code. Attached the culprit.

0 Kudos
SergeyKostrov
Valued Contributor II
1,558 Views
>>... >> _M_insert_aux( iterator __pos, _Args&&... __args ) >> { >> value_type __x_copy( std::forward<_Args>( __args )... ); // XXX copy >>... I did a verification of all the cases when std::forward<_Args>( __args ) or value_type __x_copy are used. For example, the codes never fail if an assignment is done like: ... value_type __x_copy = __x; ... I see that there is some problem related to passing the argument to a constructor of an object of value_type and could you try the following corrections for line 588? value_type __x_copy( &std::forward<_Args>( __args )... ); or value_type __x_copy = &std::forward<_Args>( __args ); I also try to look at the problem over the weekend.
0 Kudos
SergeyKostrov
Valued Contributor II
1,558 Views
>>...I also try to look at the problem over the weekend... I don't have positive results and my attempt to use deque.tcc on a Windows platform with Intel C++ compiler v12.1 looked like a desperate "fight with a windmill" because I had too many compilation errors. Please also try to contact GCC compiler developers.
0 Kudos
Richard_Geary
Beginner
1,558 Views

Thanks for the suggestions. I tried the following, it works.

  value_type __x_copy = value_type(std::forward<_Args>(__args)...); // XXX copy

This line of code existed in libstdc++ for at least a year, at least since 4.4.7.  So I think it is more like a icc issue than gcc.  Can you help forward this issue to the responsible party?

0 Kudos
SergeyKostrov
Valued Contributor II
1,558 Views
>>I tried the following, it works. >> >> value_type __x_copy = value_type(std::forward<_Args>(__args)...); // XXX copy Thank you for the update. >>...This line of code existed in libstdc++ for at least a year, at least since 4.4.7. So I think it is more like a icc issue than gcc. >>Can you help forward this issue to the responsible party? The thread is always monitored by Intel software engineers and I hope that they will investigate the problem. In case of GCC please report it by yourself. Thanks in advance.
0 Kudos
Reply