I am trying to implement modules in my existing projects, but seems I am missing something. Indeed, what works with Clang 16 “does not work” as expected with Clang 17.
With Clang 17, I get this kind of message (here adapted to the sample provided below), as soon as I use module partition:
it is deprecated to read module ‘greeter:hello’ implicitly; it is going to be removed in clang 18; consider to specify the dependencies explicitly
With the following code, I get this message 3 times.
I can get rid of it with -Wno-read-modules-implicitly
, but I do not understand why it shows up with Clang 17, as according to this draft, my code should not contain anything considered as deprecated.
Here, the content of each file:
greeter.cppm
export module greeter;
export import :world;
export import :hello;
world.cppm
module;
#include <iostream>
#include <string_view>
export module greeter:world;
namespace greeter
{
export std::string_view world(const std::string_view& n)
{
return n;
}
}
hello.cppm
module;
#include <iostream>
#include <string_view>
export module greeter:hello;
import :world;
namespace greeter
{
export void hello(const std::string_view& n)
{
std::cout << "Hello, " << greeter::world(n) << '!' << '\n';
}
}
main.cpp
import greeter;
int main ()
{
greeter::hello("World");
return 0;
}