Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Johnny_W_
Beginner
115 Views

icpc 14.0 compiler bug

After the upgrade of premier.intel.com I can't login anymore, so posting here a small reproducer for a bug in icpc 14.0.0, see below.

[build@fc19jslave09 ~]$ cat t.cpp
#include <type_traits>
class T_base;
template<typename T,
         typename = typename std::enable_if<
           std::is_base_of<T_base, T>::value>::type, typename ...Args>
void f(T const&);

template<typename T,
         typename = typename std::enable_if<
           std::is_base_of<T_base, T>::value>::type, typename ...Args>
inline void f(T const&)
{
}

[build@fc19jslave09 ~]$ icpc -std=c++0x -c  t.cpp
t.cpp(9): error: redefinition of default argument
           typename = typename std::enable_if<
                    ^

compilation aborted for t.cpp (code 2)
[build@fc19jslave09 ~]$ g++ -std=c++11 -c t.cpp
[build@fc19jslave09 ~]$ g++ --version
g++ (GCC) 4.8.1 20130603 (Red Hat 4.8.1-1)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[build@fc19jslave09 ~]$ icpc --version
icpc (ICC) 14.0.0 20130728
Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.

0 Kudos
11 Replies
SergeyKostrov
Valued Contributor II
115 Views

>>#include "type_traits" >>class T_base; >>template> typename = typename std::enable_if< >> std::is_base_of::value>::type, typename ...Args> >>void f(T const&); >> >>template> typename = typename std::enable_if< >> std::is_base_of::value>::type, typename ...Args> >>inline void f(T const&) >>{ >>} I've completed a verification on a Windows platform and there are No any problems with the test case ( successfully compiled even with older version 12 of Intel C++ ompiler ). Did you try std=c++0x command line option?
Johnny_W_
Beginner
115 Views

Yes, the exact output is above, see that this is the Intel C++ 14 compiler on Linux, installed it on a Fedora 19 box

SergeyKostrov
Valued Contributor II
115 Views

>>...Did you try std=c++0x command line option? Sorry, I see that you've used it.
Olivier_Coulaud
Beginner
115 Views

I have a similar problem on MacOs X 10.8 (same version of the compiler) with the following code cat test.cpp #include int main() { } it compiles with g++/opt/softs/gcc/4.7.2/bin/g++ -o t test.cpp -std=c++11 but with icpc 14.0 i obtain icpc -o t test.cpp -std=c++11 test.cpp(1): catastrophic error: cannot open source file "type_traits" #include compilation aborted for test.cpp (code 4) Any idea Thanks icpc --version icpc (ICC) 14.0.0 20130716 Copyright (C) 1985-2013 Intel Corporation.  All rights reserved.
TimP
Black Belt
115 Views

If you have an empty #include it appears to be a simple failure to find a corresponding source file, aside from the questionable error report.

I don't know about putting -std option after the source file.

For me, it gives a more explicit message:

test.cpp(1): catastrophic error: expected a file name
  #include
          ^

Johnny_W_
Beginner
115 Views

Looks the Developer Forum zapped some text at some point, in the textual email related to the update type_traits was listed as filename after the included file. Independent of this, this looks a complete different issue, if it can't find type_traits it looks an installation problem, not related to mine.

Olivier_Coulaud
Beginner
115 Views

Hi, 

Oups bad copy past, 

HEre the minimal code

#include <type_traits>
int main()
{

}

the result

icpc -o t test.cpp -std=c++11
test.cpp(1): catastrophic error: cannot open source file "type_traits"
#include <type_traits>
^

compilation aborted for test.cpp (code 4)

Johnny_W_
Beginner
115 Views

@Olivier, this looks really a setup problem, the compiler should be able to find this file

Judith_W_Intel
Employee
115 Views

Regarding the default argument redefinition error:

This is a valid error. You are not allowed by the C++ standard to redefine a default argument, (even to the same value). But we need to allow it since GNU allows it so we are tracking this in our bug database as a GNU compatibility as DPD 200385046. Thanks for reporting it. In the meantime you can/should fix your code by removing the duplicate default argument on the definition.

Some relevant discussions are:

http://stackoverflow.com/questions/2842928/default-value-of-function-parameter

http://stackoverflow.com/questions/4989483/where-to-put-default-parameter-value-in-c

http://stackoverflow.com/questions/6210450/the-compiler-is-complaining-about-my-default-parameters

Judy

Judith_W_Intel
Employee
115 Views

 

Regarding the lack of the header file <type_traits>, this was added by C++11 so older versions of GNU will not have it (I think it got added in GNU version 4.3). So do a g++ -v to see what version of the GNU header files you using. Intel does not provide its own set of headers/libraries, it just uses whatever is already installed on your system.

Judy

Johnny_W_
Beginner
115 Views

Yes, this is a GCC specific feature which also has been confirmed as GCC bug, see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50370

Reply