Skip to content

[C++20] [Modules] <ranges> cannot be included in more than one module #61317

Closed
@camio

Description

@camio
// A.cppm
module;
#include <ranges>
export module A;
// B.cppm
module;
#include <ranges>
export module B;
import A;
clang++ -fprebuilt-module-path=. -std=c++20  --precompile A.cppm -o A.pcm
clang++ -fprebuilt-module-path=. -std=c++20  --precompile B.cppm -o B.pcm

Compilation of the second file results in several errors like this

In module 'A' imported from B.cppm:6:
/usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/ranges:1258:2: error: 'std::ranges::views::_All::operator()' from module 'A.<global>' is not present in definition of 'std::ranges::views::_All' provided earlier
        operator() [[nodiscard]] (_Range&& __r) const
        ^
/usr/sbin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.1/../../../../include/c++/12.2.1/ranges:1258:2: note: declaration of 'operator()' does not match
        operator() [[nodiscard]] (_Range&& __r) const
        ^

This is using Clang trunk and libstdc++ that is distributed with GCC 12.2.1.

Metadata

Metadata

Assignees

Labels

clang:modulesC++20 modules and Clang Header Modules

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions