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

ICC fails to build, but GCC works

Karthik_K_
Beginner
397 Views

I am trying to build a project with ICC and it fails with atleast one of the files. I have attached the pre-processed file ? Can you help please ? 

 

 

0 Kudos
3 Replies
Anoop_M_Intel
Employee
397 Views

Hi Karthik,

What compiler options are using to build this preprocessed file?

 

0 Kudos
gaston-hillar
Valued Contributor I
397 Views

Hi Karthik K.,

Can you provide the source code, the GCC compiler options and the Intel C++ compiler options you are using. It is a bit difficult to understand the issue without more detailed info.

0 Kudos
Judith_W_Intel
Employee
397 Views

 

I was able to reproduce the compilation problems using a GNU 6.0 compiler and icpc with a GNU 6.x reference compiler (this enables -std=c++14 by default).

I saw about a half dozen compilation problems, but I think there are only two actual problems (the others are duplicates or cascading errors from the orignal error).

(1) Reported as CMPLRS-42520.

This error:

/*
clang and GNU allow this, Intel gives an error.

sptel15-400> g++ -c -std=c++14 bug1.cpp
sptel15-401> icpc -c bug1.cpp
"bug1.cpp", line 17: error: constexpr constructor calls non-constexpr
constructor for subobject initialization
constexpr LiveSet() : Parent() {}
^

1 error detected in the compilation of "bug1.cpp".
sptel15-402>

this is medium priority.
thanks
Judy
*/

template <typename Set>
struct LiveSetAccessors {
LiveSetAccessors() {}
};

template <class Accessors>
struct CommonRegSet : public Accessors
{
typedef Accessors Parent;
constexpr CommonRegSet() : Parent() {}
};

struct LiveSet
: public CommonRegSet<LiveSetAccessors<int>>
{
typedef CommonRegSet<LiveSetAccessors<int>> Parent;
constexpr LiveSet() : Parent() {}
};

//constexpr LiveSet l; // GNU gives an error here if constexpr is used

 

(2) Reported as CMPLRS-42497

/*

Intel gives an error here, GNU and Clang do not.

sptel15-407> g++ -c bug2.cpp
sptel15-408> icpc bug2.cpp
"bug2.cpp", line 13: error: class "C<int>" has no member "foo"
if (C<T>::foo(*thingp)) ;
^
detected during instantiation of "void foo2(T *) [with T=int]" at
line 21

1 error detected in the compilation of "bug2.cpp".
sptel15-409>

*/
template <typename T>
struct C {};

template <typename T>
struct C<T*>

{ static bool foo(T* v); }

;

template <typename T>
void foo2(T* thingp)

{ if (C<T>::foo(*thingp)) ; }

typedef void(fp)(int);

template < fp TraceFn = foo2> void f();

Thank you for reporting these problems...

Judy

  •  
  •  

Attachments

0 Kudos
Reply