With a class such as Foo:
struct Foo { static const int i = 9; };
I find that GCC 4.5 will reject the following
Foo f;
int x = decltype(f)::i;
It will work if I use an intermediate typedef, such as:
typedef decltype(f) ftype;
int x = ftype::i;
but I prefer to keep the namespace clean. I thought precedence may be an issue, so I've also tried parentheses, but no luck. Is it impossible as presented, or is there a piece of syntax that can help me?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…