msvc8 bug template + nested class
От: Alexander G Украина  
Дата: 19.11.09 16:19
Оценка: 82 (4)
Как думаете, скомпилируется ли и что напишет:

#include <stdio.h>

template<class>
struct X 
{
  struct Y;
};

template<class T>
struct X<T>::Y 
{ 
  int i[20]; 
  int f() { return 1; } 
};

template<class T>
struct X<T>::Y 
{
  int j[40]; 
  char f() { return 2; }
};

int main()
{
  X<void>::Y y;
  printf("%d\n", sizeof(y)/sizeof(int) );
  printf("%d\n", y.f() );
  return 0;
}
Русский военный корабль идёт ко дну!
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.