Boost logo

Boost :

Subject: [boost] [mpl] Using apply with gcc error
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-02-03 17:42:44


Compiling this code with gcc:

#include <boost/config.hpp>
#include <boost/mpl/apply.hpp>

   template
     <
     class MF,
     class T
>
   struct myMF :
     boost::mpl::apply<MF,T>
     {
     BOOST_STATIC_CONSTANT(bool,value=type::value);
     };

   int main()
     {
     return 0;
     }

Gives:

"gcc.compile.c++
..\..\..\bin.v2\libs\tti\test\TestMFHasTypeMFC.test\gcc-mingw-4.5.2\debug\TestMFHasTypeMFC.o
TestMFHasTypeMFC.cpp:18:5: error: 'type' has not been declared

     "g++" -ftemplate-depth-128 -O0 -fno-inline -Wall -pedantic -g
-Wno-variadic-macros -I"..\..\.."
-I"C:\Programming\VersionControl\boost" -c -o
"..\..\..\bin.v2\libs\tti\test\TestMFHasTypeMFC.test\gcc-mingw-4.5.2\debug\TestMFHasTypeMFC.o"
"TestMFHasTypeMFC.cpp""

MF is a metafunction with a boost::mpl::bool_ type. Since I am using
apply using metafunction forwarding, why does gcc tell me that 'type'
has not been declared ? Is this a bug in gcc or in my simple code above ?

The error occurs with all flavors of gcc, but VC++ 8,9,10 gives no error.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk