Skip to content
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

Solve anonymous namespaces and other problems #1088

Merged
merged 7 commits into from
May 1, 2022
Merged

Solve anonymous namespaces and other problems #1088

merged 7 commits into from
May 1, 2022

Conversation

adetaylor
Copy link
Collaborator

@adetaylor adetaylor commented Apr 30, 2022

Fixes #1087 through multiple different fixes:

  • Do not create constructors for generic types
  • Never tell cxx about generic types
  • Avoid name conflicts by ensuring that even destructors have labels
  • Do not create concrete types if the underlying generic type confused us
  • Avoid problems with anonymous namespaces

This commit has two fixes (which started off related but then ceased to be):

* If we ignore a template for some reason, we now no longer generate
  a concrete type for usages thereof.
  This may be more conservative than we need. It may be that some reasons
  why templates are ignored do not apply to generated concrete types.
  We may wish to relax this in future. The specific case that triggered
  it was an inner type a<b>::c, where we were unable to generate C++ to
  apply <b> to a instead of c because that information was not present
  in bindgen.
* We do not generate methods for things in anonymous namespaces, because
  we can't refer to them correctly in C++ code.

This latter fix is both too aggressive and too weak. It's too weak because
it just prevents us making methods on these things; if the types are used
as function parameters or return values we will still mis-generate code
containing "_bindgen_mod_XYZ" in C++.

On the other hand it might be that the better fix is to go ahead and
generate C++ code for these things, just stripping out the _bindgen_mod_XYZ
bits.
@adetaylor adetaylor marked this pull request as ready for review May 1, 2022 13:17
@adetaylor adetaylor changed the title Fix 1087 Solve anonymous namespaces and other problems May 1, 2022
@adetaylor adetaylor merged commit 0490d24 into main May 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug with dependent templated types
1 participant