Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
67 Views

icc 17.0.0 rejects valid C++ code with template class inheritance

Compiler version and platform: 

Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 17.0.0.098 Build 20160721

$ g++-6.2 small.cpp
$ clang++ small.cpp
$ 
$ icc small.cpp
small.cpp(14): error: no instance of function template "foo" matches the argument list
            argument types are: (A<D, C>)
    foo (a);
    ^
small.cpp(9): note: this candidate was rejected because at least one template argument could not be deduced
  template < class T > void foo (const A < T, B > &) {}
                            ^

compilation aborted for small.cpp (code 2)
$ 
$ cat small.cpp
template < class T, class S > struct A {};

struct B {};
struct C {};
struct D {};

template < class T > struct A < T, B > {};
template < class T > struct A < T, C > : public A < C, B > {};
template < class T > void foo (const A < T, B > &) {}

int main ()
{
  A < D, C > a;
  foo (a);
  return 0; 
}
$ 

 

0 Kudos
5 Replies
Highlighted
Employee
67 Views

Hi,

Please allow me sometime to reproduce and debug this issue. I will update you as soon as I am able to reproduce.

Thanks,
Varsha

0 Kudos
Highlighted
Employee
67 Views

Hi,

I have raised this issue to the Engineering team. I will let you know as soon as the fix is available.

Thanks,
Varsha

0 Kudos
Highlighted
Employee
67 Views

 

I doubt that the code is legal -- Both Microsoft and the clang compiler give a similar error.

0 Kudos
Highlighted
Beginner
67 Views

Judith, I think it should be valid.  BTW, it's accepted by the latest clang. 

0 Kudos
Highlighted
Beginner
67 Views

Just ran into this same bug on icpc version 19.0.4.243. Any chance this will get fixed?

0 Kudos