-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
Labels
kind: bugrelease item: 🐛 bug fixsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation
Milestone
Description
Description
Hi,
When just including #include <nlohmann/json.hpp> in a module, the compiler complains about impossible references.
It is not happening when not inside a module.
Reproduction steps
Just include the header inside a module and compile with -fmodules-ts.
This is the triggering flag, really.
Expected vs. actual results
No error
Minimal code example
//mod.cxx:
module;
#include <iostream>
#include <string_view>
#include <string>
#include <nlohmann/json.hpp>
export module hello;
export {
namespace X {
void greeter ( std::string_view const &name ){
std::string h = "exported greeter";
std::cout << "Hello " << name << "!" << h << "\n";
}
}
}
// main.cpp
import hello;
int main ( void ){
X::greeter("ok");
return 0;
}
// compile with
~/gcc-12.1/g++ -fmodules-ts -std=c++20 -I/my_path/include/ mod.cxx main.cpp
Error messages
`/usr/include/nlohmann/adl_serializer.hpp:41:17: error: ‘static decltype ((nlohmann::{anonymous}::to_json(j, forward<ValueType>(val)), void())) nlohmann::adl_serializer<T, SFINAE>::to_json(BasicJsonType&, ValueType&&) [with BasicJsonType = nlohmann::basic_json<>; ValueType = bool&; <template-parameter-1-1> = bool; <template-parameter-1-2> = void; decltype ((nlohmann::{anonymous}::to_json(j, forward<ValueType>(val)), void())) = void]’ references internal linkage entity ‘constexpr const nlohmann::detail::to_json_fn& nlohmann::{anonymous}::to_json’
41 | static auto to_json(BasicJsonType& j, ValueType&& val) noexcept(`
Compiler and operating system
Linux GCC-12.1
Library version
Latest
Validation
- The bug also occurs if the latest version from the
develop
branch is used. - I can successfully compile and run the unit tests.
Metadata
Metadata
Assignees
Labels
kind: bugrelease item: 🐛 bug fixsolution: proposed fixa fix for the issue has been proposed and waits for confirmationa fix for the issue has been proposed and waits for confirmation