|
|
От: |
tolgamrab
|
|
| Дата: | 05.02.10 17:17 | ||
| Оценка: | |||
А>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
А>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.
8.3.5/7 A typedef of function type may be used to declare a function but shall not be used to define a function (dcl.fct.def). [Example:
typedef void F();
F fv; // OK: equivalent to void fv();
F fv { } // ill-formed
void fv() { } // OK: definition of fv
--- end example] A typedef of a function type whose declarator includes a cv-qualifier-seq shall be used only to declare the function type for a nonstatic member function, to declare the function type to which a pointer to member refers, or to declare the top-level function type of another function typedef declaration. [Example:
typedef int FIC(int) const;
FIC f; // ill-formed: does not declare a member function
struct S {
FIC f; // OK
};
FIC S::*pm = &S::f; // OK
--- end example]