I discovered a strange VC++ bug using Boost.typeof. I am not posting
this to rag VC++ but wondering if there is some known workaround in
Boost or in Boost.config.
#include
template <class T>
struct dereference
{
typedef BOOST_TYPEOF_TPL(*T()) type;
};
int main()
{
}
Compiling this with VC++12 gives:
test_vc_type_of_indirection.cpp(6) : error C2100: illegal indirection
test_vc_type_of_indirection.cpp(7) : see reference to class
template instantiation 'dereference<T>' being compiled
Notice that I am not even instantiating 'dereference'.
But if I write:
#include
template <class T>
struct dereference
{
void afunction() { typedef BOOST_TYPEOF_TPL(*T()) type; }
};
int main()
{
}
all is well, for all the good it does me.
BOOST_TYPEOF_TPL(*T()) expands to:
typename
boost::type_of::msvc_typeid_wrapper::type
and if I substitute this directly the same results occur.
I can report this to the VC++ bug tracker but wanted to see if this is a
known problem with VC++ in Boost, some weird error for which maybe Boost
has some workaround syntax.