1

Doxygen 1.8.11 is choking on the following definition, which I simplified as much as I could without losing the warning message:

template <class T>
struct MySpecialization<T, void_t<decltype(std::declval<T>().foo(
                             std::declval<double>()))>> : std::true_type {};

The warning is:

warning: Found ';' while parsing initializer list! (doxygen could be confused by a macro call without semicolon)

Interestingly, Doxygen is fine with the following:

template <class T>
struct MySpecialization<T, void_t<decltype(std::declval<T>().foo())>> : std::true_type {};

which is basically the same definition without an argument to foo.

I would very much appreciate a workaround. In the worst case, I would like to somehow cause Doxygen to ignore this definition.

AlwaysLearning
  • 7,257
  • 4
  • 33
  • 68

2 Answers2

2

The answer is in the docs. Use doxygen's \cond and \endcond commands or use preprocessor defines.

/// \cond NOPE
template <class T>
struct MySpecialization<T, void_t<decltype(std::declval<T>().foo(
                             std::declval<double>()))>> : std::true_type {};
/// \endcond

With preprocessor defines you can add Doxygen-friendly definition. For example, the Qt project does this.

#ifdef DOXYGEN_WORKING
template <class T>
struct MySpecialization<T, something_that_doxygen_understands> : std::true_type {};
#else
template <class T>
struct MySpecialization<T, void_t<decltype(std::declval<T>().foo(
                             std::declval<double>()))>> : std::true_type {};
#endif

and add PREDEFINED = DOXYGEN_WORKING to your config file.

albert
  • 8,285
  • 3
  • 19
  • 32
krzaq
  • 16,240
  • 4
  • 46
  • 61
  • 1
    @AlwaysLearning: That is the alternative. The example given makes use of `\cond` and `\endcode`. Visit the documentation; it's in the _frequently asked questions_ list, which should have been your very first port of call.... This answer author even linked you directly to the specific page for maximum convenience. – Lightness Races in Orbit Oct 09 '16 at 12:04
  • But what exactly in the example definition confuses Doxygen? – AlwaysLearning Oct 09 '16 at 12:08
  • 1
    @AlwaysLearning C++ is non-trivial to parse, and the tool predates clang-as-a-library. You'd probably have to delve deep into the code to find what exactly is the problem, but I don't know how that would be more helpful than doing what everyone else does ;) – krzaq Oct 09 '16 at 12:13
  • Thank you. With this in mind, I also accept the criticism for not looking up the documentation first. – AlwaysLearning Oct 09 '16 at 12:17
2

I've just committed a fix in GitHub for this issue, see https://github.com/doxygen/doxygen/commit/985faf287233badf65fa33d21bde17afa6970d60

doxygen
  • 14,341
  • 2
  • 43
  • 37
  • Thanks! Can I assume that version 1.8.13. will have this fix integrated? – AlwaysLearning Oct 13 '16 at 07:45
  • @AlwaysLearning yes indeed. – doxygen Oct 13 '16 at 17:06
  • I would very much appreciate if you could look at the questions I posted today about some behaviors of Doxygen that look like definite bugs: http://stackoverflow.com/questions/40386042/include-guards-and-commented-out-doxygen-comments-affect-the-output-of-doxygen, http://stackoverflow.com/questions/40382849/doxygen-does-not-see-the-description-of-a-pre-processor-symbol, http://stackoverflow.com/questions/40358150/doxygen-demands-that-an-include-guard-be-documented – AlwaysLearning Nov 02 '16 at 18:06