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

"inline" linkage necessary #65

Open
aaron-michaux opened this issue Nov 21, 2018 · 6 comments
Open

"inline" linkage necessary #65

aaron-michaux opened this issue Nov 21, 2018 · 6 comments

Comments

@aaron-michaux
Copy link

The following lines in optional.hpp should have "inline" linkage. This is necessary for using <boost/optional/optional.hpp> in a module.

    const in_place_init_t in_place_init((in_place_init_t::init_tag()));

   const in_place_init_if_t
       in_place_init_if((in_place_init_if_t::init_tag()));

@aaron-michaux
Copy link
Author

I'm not sure how this code could be correct in a header-only library without inline.

@akrzemi1
Copy link
Member

global objects declared const have internal linkage.

@aaron-michaux
Copy link
Author

aaron-michaux commented Nov 21, 2018 via email

@gast128
Copy link

gast128 commented Nov 27, 2023

Can't these be turned into inline constexpr variables with BOOST_INLINE_CONSTEXPR. I had 2 hits:

  • const in_place_init_t in_place_init ((in_place_init_t::init_tag()));
  • const in_place_init_if_t in_place_init_if ((in_place_init_if_t::init_tag()));

@akrzemi1
Copy link
Member

Can't these be turned into inline constexpr variables with BOOST_INLINE_CONSTEXPR.

They could in C++17. But this has to work in C++11. I could special-case it for C++17, but there have to be sufficient motivation. Can someone point me to the place (in the IS perhaps) that tells if/why the current implementation is incompatible with modules?

@gast128
Copy link

gast128 commented Nov 27, 2023

They could in C++17. But this has to work in C++11

I think BOOST_INLINE_CONSTEXPR expands to 'inline constexpr' when available and otherwise to 'const'. It may miss the 'static const' case though. Perhaps there is a Boost guideline.

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

3 participants