
12 Sep
2007
12 Sep
'07
4:03 p.m.
When some type traits, for instance is_base_of, are called with incomplete types, then they may silently "return" incorrect results. It would be better if they failed to compile with incomplete types. Here is a suggestion how that might be implemented: template<int> struct assert_complete0 {}; template<typename T> struct assert_complete : public assert_complete0<sizeof(T)> {}; template<typename B, typename T> is_base_of : public assert_complete<B>, public assert_complete<T> ... I have tested this with with VC 7.1, and it works. Will this work on other platforms? Are there any reasons not to add this check? Johan Råde CTO, Qlucore AB