Forward declaration of struct - compile error, "declaration of anonymous struct must be a definition"

1.8k views Asked by At

I'm compiling an application that uses sigc++. It fails with this error:

In file included from /opt/local/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:7:
/opt/local/include/sigc++-2.0/sigc++/functors/functor_trait.h:17:1: error: declaration of anonymous struct must be a definition
struct nil;

The code in question is:

              namespace sigc {

              /** nil struct type.
               * The nil struct type is used as default template argument in the
               * unnumbered sigc::signal and sigc::slot templates.
               *
               * @ingroup signal
               * @ingroup slot
               */
              #ifndef DOXYGEN_SHOULD_SKIP_THIS
error here -> struct nil;
              #else
              struct nil {};
              #endif

What I can't figure out, is why the compiler thinks it's an anonymous struct. Isn't the line in question just a forward declaration?

0

There are 0 answers