svenevs / exhale

Automatic C++ library api documentation generation: breathe doxygen in and exhale it out.
BSD 3-Clause "New" or "Revised" License
219 stars 51 forks source link

Issue with detection of `<` operator #217

Open ajay-mk opened 3 months ago

ajay-mk commented 3 months ago

Getting the following error with version 0.3.7:

meta::is_less_than_comparable< T, std::void_t< decltype(std::declval< const T & >()< std::declval< const T & >())> > has 5 '<' and 4 '>', exhale does not know what to do with your code.Traceback (most recent call last)

The additional < is the operator, not part of the braces, so the syntax is correct. Looks similar to #169. If I understand things correctly, the syntax doesn't satisfy the conditions for operator_overload to be True in the following lines https://github.com/svenevs/exhale/blob/c99592533143b5144a69bf685c85cdb63e534b0b/exhale/graph.py#L2449-L2452

Version info: Doxygen: 1.11 Breathe: 4.35 Sphinx: 7.1.2

ajay-mk commented 3 months ago

Gentle bump @svenevs. Not urgent, but it would be nice to have this fixed.

svenevs commented 3 months ago

Hey, thank you for the report and gentle nudge. This is unfortunately actually quite a difficult issue, and may mean we cannot solve this problem with regex anymore... Teaching exhale how to parse more complicated templates isn't exactly a viable long term solution.

If you post a self contained example (just give me working compilable / runnable header file and source file of relevant). I can add it to the (very complicated) test framework IF you agree to it being CC0 license.

Giving a self contained reproducer can help bootstrap the solution / save time. But I am worried that there may not be a clean solution here :confused:

Please feel free to nudge again this Saturday so I remember to take a look, this week is shaping up to be pretty chaotic.

I'm sorry to share the mixed bag news (may not be a quick fix, which may mean no easy fix attainable). I'm pretty sure concepts break the assumptions being made in the code you linked.

Edit: clarification: I'm pretty sure there are other hidden problems with that code, so it's worth doing a survey of what has changed and what possible solutions are available these days.

ajay-mk commented 2 months ago

Thanks for your reply. I have been playing around with breathe-apidoc and exhale and still haven't decided which one to pick, but leaning towards exhale 🙂

Here is an example code to reproduce the issue (I hope this is enough):

template <typename T, typename = std::void_t<>>
struct is_less_than_comparable : public std::false_type {};

template <typename T>
struct is_less_than_comparable<T,
                               std::void_t<decltype(std::declval<const T &>() <
                                                    std::declval<const T &>())>>
    : public std::true_type {};