Skip to content

Fix compiler error when using with C++ Modules - #850

Merged
djowel merged 1 commit into
boostorg:developfrom
fedapo:fix-usage-with-cpp-modules
Oct 29, 2026
Merged

djowel merged 1 commit into
boostorg:developfrom
fedapo:fix-usage-with-cpp-modules

Conversation

@fedapo

@fedapo fedapo commented Oct 15, 2026 •

Copy link
Copy Markdown

Fix a compiler error when including Boost.Spirit.X3 headers from a C++ module header unit.
The output of a typical error follows. It is related to exposing objects with local linkage. The solution seems to avoid the following items in headers:

  • objects declared as static
  • objects declared within an anonymous namespace
  • const objects

These can be fixed by setting them as inline instead.

In file included from /home/federico/vcpkg/installed/x64-linux-release/include/boost/spirit/home/x3/operator.hpp:14,
                 from /vcpkg/installed/x64-linux-release/include/boost/spirit/home/x3.hpp:67,
                 from <...>.ixx:8:
/vcpkg/installed/x64-linux-release/include/boost/spirit/home/x3/operator/difference.hpp:30:14: error: ‘template<class Left, class Right> template<class Iterator, class Context, class RContext, class Attribute> bool boost::spirit::x3::difference<Left, Right>::parse(Iterator&, const Iterator&, const Context&, RContext&, Attribute&) const’ exposes TU-local entity ‘boost::spirit::x3::unused’

@fedapo
fedapo force-pushed the fix-usage-with-cpp-modules branch from 039f0eb to 42012d0 Compare October 15, 2026 08:49
@fedapo
fedapo force-pushed the fix-usage-with-cpp-modules branch from 42012d0 to 493a8cf Compare October 15, 2026 10:52
@djowel
djowel merged commit 77fd9e6 into boostorg:develop Oct 29, 2026
11 of 15 checks passed
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.

3 participants