-
Notifications
You must be signed in to change notification settings - Fork 747
bindgen generates duplicate definitions #359
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
Comments
Output:
|
Thanks for the bug report! |
Yep, we saw the exact same thing with opencv in a previous report, but I didn't have the time to construct a test case that wasn't the stdlib, so thanks! :). Short term solution thing is probably to BTW, if you're binding complex C++ it's probably ok to use bindgen's namespace support with |
Gah, this test case is tricky. A bit more minimized: namespace std
{
template < typename > struct char_traits;
}
namespace __gnu_cxx
{
template < typename > struct char_traits;
}
namespace std
{
template < class _CharT > struct char_traits:__gnu_cxx::char_traits <
_CharT >
{
};
} Basically, what we're doing is: When we see the forward declaration, we go to the definition and parse it, then we assume that the base class specifier needs to be a complete type, and assume we're going to find it as already resolved. But that's not true, sigh. I think I have a fix, but I'll have to test it a bit more. |
And since it's not true, we go ahead and parse it as-if it was in our own namespace, which is wrong, and then we generate the duplicate definition. |
See #360. Thanks for the test case again, was super helpful to figure out what was going on! |
No problem! |
Indeed it is :) |
Uh oh!
There was an error while loading. Please reload this page.
This command and input generates two distinct definitions for
std_char_traits
. I tried both--enable-cxx_namespaces
and--disable-name-namespacing
, but neither made a significant difference.Command:
bindgen stdcxx.i -- -x c++ -std=c++14
Input:
The text was updated successfully, but these errors were encountered: