-
-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spurious "duplicate declaration" error with class members #406
Comments
None of those two issues seem related. I'll try to see if I can single out the offending declaration (it would be nice if breathe said exactly what is duplicated). |
Ok, the two conflicting method declarations are the following (I'm omitting the implementations): /// \brief Append a sequence of elements in one shot, with a specified nullmap
/// \param[in] values_begin InputIterator to the beginning of the values
/// \param[in] values_end InputIterator pointing to the end of the values
/// \param[in] valid_begin InputIterator with elements indication valid(1)
/// or null(0) values
/// \return Status
template <typename ValuesIter, typename ValidIter>
typename std::enable_if<!std::is_pointer<ValidIter>::value, Status>::type AppendValues(
ValuesIter values_begin, ValuesIter values_end, ValidIter valid_begin) {
...
}
/// \brief Append a sequence of elements in one shot, with a specified nullmap
/// \param[in] values_begin InputIterator to the beginning of the values
/// \param[in] values_end InputIterator pointing to the end of the values
/// \param[in] valid_begin uint8_t* indication valid(1) or null(0) values.
/// nullptr indicates all values are valid.
/// \return Status
template <typename ValuesIter, typename ValidIter>
typename std::enable_if<std::is_pointer<ValidIter>::value, Status>::type AppendValues(
ValuesIter values_begin, ValuesIter values_end, ValidIter valid_begin) {
...
}
This is the same template method implemented differently, depending on parameter type, using SFINAE. |
I'm quite sure this particular problem is a missing check in Sphinx. Please open an issue over there with a pointer to this issue, then I'll get around to it at some point. |
Ok, I opened sphinx-doc/sphinx#5755 in Sphinx. |
Note this is easily circumvented by removing one of the docstrings... Still, it is highly not obvious how to diagnose the issue and find the workaround. |
Thanks. I'll try to get the warning message improved as well (i.e., changing line https://github.com/sphinx-doc/sphinx/blob/master/sphinx/domains/cpp.py#L6459) |
I've got another case where I get a "duplicate declaration" with doxygen 1.8.14 (but not 1.8.13). It boils down to: class BasicDecimal128 {
public:
/// \brief Create a BasicDecimal128 from the two's complement representation.
constexpr BasicDecimal128(int64_t high, uint64_t low) noexcept
: low_bits_(low), high_bits_(high) {}
/// \brief Empty constructor creates a BasicDecimal128 with a value of 0.
constexpr BasicDecimal128() noexcept : BasicDecimal128(0, 0) {}
private:
uint64_t low_bits_;
int64_t high_bits_;
};
class Decimal128 : public BasicDecimal128 {
public:
using BasicDecimal128::BasicDecimal128;
/// \brief Empty constructor wrapper over BasicDecimal128. This is required on some
/// older compilers.
constexpr Decimal128() noexcept : BasicDecimal128() {}
}; Together with: .. doxygenclass:: arrow::Decimal128
:project: arrow_cpp
:members: I get:
This is with breathe 4.11.1 and sphinx 1.8.4+/d58f1018. |
Note it would also be nice to disable those "duplicate definition" warnings. There seem to be too many quirks with Doxygen-generated symbols. |
I think the new problem may be in the same family as #356. |
Not sure. I am not documenting the base class here (not in Sphinx, I mean). Also I have |
This might be fixed with #512, released in Breathe v4.17.0. Note that you also need Sphinx 3.x for recent Breathe versions. Could someone try and post results? |
I still get a similar error related to two SFINAE methods with doxygen 1.8.20, sphinx 3.2.1 and breathe 4.21.0. The code triggering the issue is reproduced below template <typename T>
using SupportsMemoryIO = std::is_constructible<T, std::shared_ptr<MemoryBuffer>, File::Mode, File::Compression>;
class FormatFactory final {
public:
// [...]
/// Register a given `Format` in the factory if it supports memory IO
template<class Format, enable_if_t<SupportsMemoryIO<Format>::value, int> = 0>
void add_format() {
// [...]
}
/// Register a given `Format` in the factory if it does not support memory IO
template<class Format, enable_if_t<!SupportsMemoryIO<Format>::value, int> = 0>
void add_format() {
// [...]
}
// [...]
}; .. doxygenclass:: chemfiles::FormatFactory
:members: |
For one (and only one) of the classes in my project, I get a "duplicate declaration error" than I cannot explain:
The directive is as follows:
If I remove the
:members:
flag, the error isn't emitted. How do I discover which member exactly is causing the duplicate declaration error, and why?The text was updated successfully, but these errors were encountered: