Ограницения template type arguments
От: Аноним  
Дата: 01.02.10 17:09
Оценка:
Большинство компайлеров транслируют:
template<class T> struct A {
static T t; // 1
T *pt;      // 2
};

typedef int function();
A<function> a;  // ill-formed: would declare A<function>::t
                // as a static member function

Comeau ругает строку с // 1

14.3.1/3 If a declaration acquires a function type through a type dependent on a template-parameter and this causes a declaration that does not use the syntactic form of a function declarator to have function type, the program is ill-formed.


Проясните ситуацию в случае 2, должен ли компайлер разрешать, или нет? какие причины запрета в 1?
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.