Community
cancel
Showing results for 
Search instead for 
Did you mean: 
de666
Beginner
73 Views

Template code compilation issue #2

this code does not compile with icc11 however is valid c++
it compiles with msvc versions 7, 7.1 & 8

[cpp]#include    
  
template struct s;   
template<> struct s {};   
template<> struct s : public s   
{};   
  
struct Int : public s {};   
  
template   
void foo(const s&)   
{ std::cout << "in foo(const s<" << typeid(type).name() << ">&)n"; }   
  
int main()   
{   
  Int i;   
  foo(i);  //here an error appears   
  return 0;   
}[/cpp]

previous discussion: http://software.intel.com/en-us/forums/showthread.php?t=70491
0 Kudos
2 Replies
Judith_W_Intel
Employee
73 Views

Quoting - de666
this code does not compile with icc11 however is valid c++
it compiles with msvc versions 7, 7.1 & 8

[cpp]#include    
  
template struct s;   
template<> struct s {};   
template<> struct s : public s   
{};   
  
struct Int : public s {};   
  
template   
void foo(const s&)   
{ std::cout << "in foo(const s<" << typeid(type).name() << ">&)n"; }   
  
int main()   
{   
  Int i;   
  foo(i);  //here an error appears   
  return 0;   
}[/cpp]

previous discussion: http://software.intel.com/en-us/forums/showthread.php?t=70491

this is the same issue as in the previous discussion (link above)
de666
Beginner
73 Views

ok
let's continue in the old thread
you may want to delete this one
Reply