Skip to content

Error with C++ modules: not present in definition provided earlier #61642

Closed
@rnikander

Description

@rnikander

Here is a boiled down version of something happening in a real project.

Mod1.cc

module;
#include <ranges>
export module Mod1;

Mod2.cc

module;
#include <iterator>
#include <valarray>
#include <ranges>
export module Mod2;
import Mod1;

build.sh

CXX="/Users/rob/Dev/llvm-project/build/bin/clang++ -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.sdk -std=c++2b"
set -e
$CXX -fprebuilt-module-path=. -x c++-module Mod1.cc --precompile -o Mod1.pcm
$CXX -fprebuilt-module-path=. -x c++-module Mod2.cc --precompile -o Mod2.pcm

Errors:

In module 'Mod1' imported from Mod2.cc:6:
/llvm-project/build/bin/../include/c++/v1/__ranges/zip_view.h:494:40: error: 'std::__1::ranges::views::__zip::__fn::operator()' from module 'Mod1.<global>' is not present in definition of 'std::__1::ranges::views::__zip::__fn' provided earlier
  _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Ranges&&... __rs) const
                                       ^
/llvm-project/build/bin/../include/c++/v1/__ranges/zip_view.h:491:40: note: declaration of 'operator()' does not match
  _LIBCPP_HIDE_FROM_ABI constexpr auto operator()() const noexcept { return empty_view<tuple<>>{}; }
                                       ^
/llvm-project/build/bin/../include/c++/v1/__ranges/zip_view.h:494:40: note: declaration of 'operator()' does not match
  _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Ranges&&... __rs) const
                                       ^
1 error generated.

Metadata

Metadata

Assignees

No one assigned

    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