Возможный дубликат:
Где и почему мне нужно вставлять ключевые слова «шаблон» и «имя типа»?
Похоже, в GCC 4.5.3 есть ошибка:
Код: Выделить всё
#include
template
struct Foo
{
template
static inline void* Do(size_t size);
};
template
struct Foo
{
template
static inline void* Do(size_t size)
{
return NULL;
}
};
template
struct Foo
{
template
static inline void* Do(size_t size)
{
return NULL;
}
};
class Bar
{
};
template
int Do(size_t size)
{
// The following fails
return (int) Foo::Do(size);
// This works -- why?
return (int) Foo::Do(size);
}
int main()
{
return Do(10);
}
g++ bug.cpp -std=c++0x
Ошибки:
Код: Выделить всё
bug.cpp: In function ‘int Do(size_t)’:
bug.cpp:37:65: error: expected primary-expression before ‘>’ token
РЕДАКТИРОВАТЬ: MSVC 2010 управляется чтобы скомпилировать это просто отлично.
Подробнее здесь: https://stackoverflow.com/questions/131 ... -gcc-error
Мобильная версия