-
-
Notifications
You must be signed in to change notification settings - Fork 198
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
Unable to resolve friend function and implementation #627
Comments
@YannickJadoul Can you post the RST in question? You should be able to make it work by specifying the arguments explicitly, the checks for this have gotten more strict in #623 as you have noticed. |
@vermeeren Sure! It's just a simple
I've also tried
|
I've made a minimal example. That should hopefully make things easier for you than a vague description. class Foo {
friend void bar();
};
namespace mwe {
/// Wenn ist das Nunstück git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput!
void bar() {}
} .. doxygenfunction:: bar Here's the full minimal working example zipped, which should hopefully just show the error when running PS: I had to also wrap |
I think this is a real issue, but a long-standing one that got exposed by the struct Foo;
struct Bar:
void doStuff(const Foo &f, const Bar &b); // #1
struct Foo {
// ...
public:
friend void doStuff(const Foo &f, const Bar &b); // #2
};
struct Bar {
// ...
public:
friend void doStuff(const Foo &f, const Bar &b); // #3
}; Then I would consider (1) to be the point of documentation, and (2), (3) should not be documented as function declarations, but similarly to a friend class declaration, optimally with On the other hand, if we have: // doStuff not declared yet
struct Foo {
// ...
public:
friend void doStuff(const Foo &f); // #1
};
// ... optionally
void doStuff(const Foo &f) { /* ... */ } // #2 (E.g., think of For the initial example with The mwe looks different, due to the namespace around the second function declaration, so the two Some issues and thoughts:
|
Sure, definitely! This fails in the same way (i.e., namespace mwe {
class Foo {
friend void bar();
};
/// Wenn ist das Nunstück git und Slotermeyer? Ja! Beiherhund das Oder die Flipperwaldt gersput!
void bar() {}
} The reason I added the namespace in the first place is because of another error without it. Just having
gives
And with the
I'll attach this here: mwe_no_namespace.zip |
I appreciate this is a hairy problem, by the way! No rush from my part, as I've work around it with a well-placed If there's anything I can do, do let me know! |
I might be doing something wrong, but could it be that the changes from #623 (related to #613) have made forward declarations of friend functions ambiguous?
Our code (in pybind/pybind11#2828) looks something like this:
When I don't wrap the two
friend
forward declarations in a#ifdef DOXYGEN_SHOULD_SKIP_THIS
, breathe comes complaining as follows:I bumped the version from 4.25.1 to 4.26.1, and this error appeared. As far as I know, things just worked before that version bump. Can I disambiguate between these two in some way, or is this an issue?
The text was updated successfully, but these errors were encountered: