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

Potential collision with C++20 module keyword #1593

Closed
dalboris opened this issue Nov 5, 2018 · 4 comments
Closed

Potential collision with C++20 module keyword #1593

dalboris opened this issue Nov 5, 2018 · 4 comments

Comments

@dalboris
Copy link
Contributor

dalboris commented Nov 5, 2018

Hi everyone,

I just wanted to bring to your attention that the name module is likely to become a keyword in C++20, which I believe would cause a collision with pybind11::module. Maybe you already know this, maybe not, but I thought I'd better write something here just in case.

Here is an interesting discussion from Vulkan facing similar problems: KhronosGroup/Vulkan-Docs#568

Related links:
https://www.reddit.com/r/cpp/comments/4b9qru/what_exactly_is_the_proposed_module_system_how/
https://clang.llvm.org/docs/Modules.html

@EricCousineau-TRI
Copy link
Collaborator

EricCousineau-TRI commented Dec 18, 2018

I guess this may not contribute much, but future proofing the library at least should be simple enough:

class module_ { ... };

#if !defined(PYBIND11_CPP20)
using module = module_;
#endif

@dalboris
Copy link
Contributor Author

This makes sense to me :) Note that there's a typo in your post above (module = module), but you've corrected it in the PR. I haven't looked into the PR in detail, or tested the code, I just wanted to say that I agree with this general approach, and that if I was in charge I'd probably have done it the same way: there is already an underscore in class_ for the same reason.

@EricCousineau-TRI
Copy link
Collaborator

Thanks! And oops! Corrected.

@dalboris
Copy link
Contributor Author

dalboris commented Apr 8, 2019

Closing this (see #1639).

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

No branches or pull requests

2 participants