title: Boost variant apply_visitor compilation error
body: <p>This simple example code for boost::variant and boost::apply_visitor:</p>
  
  <pre><code>#include &lt;boost/variant/recursive_variant.hpp&gt;
  
  struct ExprFalse;
  struct ExprTrue;
  struct ExprMaybe;
  
  typedef boost::variant&lt;
      ExprFalse,
      ExprTrue,
      ExprMaybe
      &gt; Expression;
  
  struct ExprFalse { };
  struct ExprTrue { };
  struct ExprMaybe { };
  
  struct Printer : public boost::static_visitor&lt;&gt;
  {
  public:
      Printer(std::ostream&amp; os) : m_os(os) { }
      void operator()(ExprFalse const&amp; expr) const { m_os &lt;&lt; "False"; }
      void operator()(ExprTrue const&amp; expr) const { m_os &lt;&lt; "True"; }
      void operator()(ExprMaybe const&amp; expr) const { m_os &lt;&lt; "Maybe"; }
  
  private:
      std::ostream&amp; m_os;
  };
  
  int main()
  {
      Expression e(ExprTrue());
      boost::apply_visitor(Printer(std::cout), e);
      return 0;
  }
  </code></pre>
  
  <p>Produces the following compilation error:</p>
  
  <pre><code>g++-mp-4.8 -MMD -DBOOST_ALL_DYN_LINK -DBOOST_SPIRIT_USE_PHOENIX_V3 -Wall -std=c++11 -Os -O3 -g -I/o\
  pt/local/include -I./  -c tools/t6.cpp -o tools/build/x86_64/objs/t6.o
  In file included from /opt/local/include/boost/variant/apply_visitor.hpp:16:0,
                   from /opt/local/include/boost/variant/detail/hash_variant.hpp:23,
                   from /opt/local/include/boost/variant/variant.hpp:37,
                   from /opt/local/include/boost/variant/recursive_variant.hpp:36,
                   from tools/t6.cpp:4:
  /opt/local/include/boost/variant/detail/apply_visitor_unary.hpp: In instantiation of 'typename Visi\
  tor::result_type boost::apply_visitor(const Visitor&amp;, Visitable&amp;) [with Visitor = Printer; Visitabl\
  e = boost::variant&lt;ExprFalse, ExprTrue, ExprMaybe&gt;(ExprTrue (*)()); typename Visitor::result_type =\
   void]':
  tools/t6.cpp:35:47:   required from here
  /opt/local/include/boost/variant/detail/apply_visitor_unary.hpp:76:43: error: request for member 'a\
  pply_visitor' in 'visitable', which is of non-class type 'boost::variant&lt;ExprFalse, ExprTrue, ExprM\
  aybe&gt;(ExprTrue (*)())'
       return visitable.apply_visitor(visitor);
                                             ^
  /opt/local/include/boost/variant/detail/apply_visitor_unary.hpp:76:43: error: return-statement with\
   a value, in function returning 'void' [-fpermissive]
  make: *** [tools/build/x86_64/objs/t6.o] Error 1
  </code></pre>
  
  <p>On Mac OSX Mavericks using Boost version 1.55.0.</p>
  
  <p>For the life of me, I cannot figure out the issue. I've tried actually having a return type (even though the print visitor doesn't need one), but I ended up with the same error.</p>
  
  <p>Any insight would be appreciated.</p>