Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

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

$
0
0

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;
}
$

 


Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>