Skip to content

parser.hpp: make compatible with modules#16

Merged
BlackMark29A merged 1 commit into
ph3at:mainfrom
autoantwort:fix/cpp-20-modules
May 19, 2026
Merged

parser.hpp: make compatible with modules#16
BlackMark29A merged 1 commit into
ph3at:mainfrom
autoantwort:fix/cpp-20-modules

Conversation

@autoantwort

Copy link
Copy Markdown

parse_bool is referenced from env::variable_id via some other types. If I now have

module;
#include <libenvpp/env.hpp>
export module testModule;
export
{
    template <typename VarType, bool Required>
    struct EnvironmentVariableBase
    {
env::variable_id<VarType, Required> m_id;
    }
}

I export a type that references a TU local definition in its template instantiation, which is invalid c++ and causes gcc to crash (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125356). inline is enough here and also prevents binary bloat since only one definition is created for every TU that includes env.hpp.

`parse_bool` is referenced from `env::variable_id` via some other types.
If I now have
```c++
module;
#include <libenvpp/env.hpp>
export module testModule;
export
{
    template <typename VarType, bool Required>
    struct EnvironmentVariableBase
    {
env::variable_id<VarType, Required> m_id;
    }
}
```
I export a type that references a TU local definition in its template instantiation, which is invalid c++ and causes gcc to crash (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125356).
inline is enough here and also prevents binary bloat since only one definition is created for every TU that includes `env.hpp`.
@BlackMark29A BlackMark29A merged commit 2007a12 into ph3at:main May 19, 2026
26 of 30 checks passed
@BlackMark29A

Copy link
Copy Markdown
Member

Thanks. I'll create a new release at some point soon with this change.

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.

2 participants