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

Templates/static(?) compilation issues

Navumuk__Anton
Beginner
555 Views

Hello! I'm trying to build Unreal Engine with Intel Compiler 17.0 but I'm getting quite interesting error. ICC complains about 'incomplete type' in multiple places. These places boil down to the following code snippet:

template <class Base>
class B : public Base
{};
 
class A
{
      static B<A> StaticMember; // D'OH! ICC:  incomplete type is not allowed
};

VC++, gcc and clang compile it while ICC complains about an incomplete type. Why is this the case? What is the reason behind ICC behaviour?

0 Kudos
4 Replies
Viet_H_Intel
Moderator
555 Views

Hello,

 I tried with all 6 versions of 17.0, but  was not able to reproduce the issue.

$ cat t.cpp
template <class Base>
class B : public Base
{};

class A
{
      static B<A> StaticMember; // D'OH! ICC:  incomplete type is not allowed
};
$ icpc t.cpp -c -V
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.5.239 Build 20170817
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

$

 

 

 

0 Kudos
Navumuk__Anton
Beginner
555 Views

Hello. That's weird. Also I'm trying to compile it on Windows

Source.cpp:

template <class Base>
class B : public Base
{};

class A
{
	static B<A> StaticMember; // D'OH! ICC:  incomplete type is not allowed
};

int main()
{
	return 0;
}

And that's what I get:

Microsoft Windows [Version 10.0.16299.64]
(c) 2017 Microsoft Corporation. All rights reserved.

~>"C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\bin\compilervars.bat" intel64 vs2015
Copyright (C) 1985-2017 Intel Corporation. All rights reserved.
Intel(R) Compiler 17.0 Update 4 (package 210)


~>icl Source.cpp
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.4.210 Build 20170411
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

Source.cpp
Source.cpp(2): error: incomplete type is not allowed
  class B : public Base
                   ^
          detected during instantiation of class "B<Base> [with Base=A]" at line 7

compilation aborted for Source.cpp (code 2)

 

0 Kudos
Murashko__Alexander
555 Views

Hello, All!

I tried this code on Windows 10 and have same error:

Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.0.124 Build 20170811
Copyright (C) 1985-2017 Intel Corporation.  All rights reserved.

test.cpp
test.cpp(2): error: incomplete type is not allowed
  class B : public Base
                   ^
          detected during instantiation of class "B<Base> [with Base=A]" at line 7

compilation aborted for test.cpp (code 2)

 

0 Kudos
Murashko__Alexander
555 Views

Intel support, could you check issue on windows platform?

0 Kudos
Reply