llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.41k stars 12.15k forks source link

"Definition with same mangled name as another definition" error when compiling C++20 Modules #118137

Open MikailBag opened 3 days ago

MikailBag commented 3 days ago

My code: https://gist.github.com/MikailBag/5803041040c052deda1d06893eae67e1 (Please note that is requires stdexec, which is AFAIK reference implementation of the C++26 std::execution)

When running build.sh, I get following error:

/tmp/build/vcpkg_installed/x64-linux-clang/include/exec/../stdexec/__detail/__transform_sender.hpp:103:9: error: definition with same mangled name '_ZNK7stdexec8__domain18__transform_senderclIS1_NS_14default_domainENS_7__sexprIXtlNS_12_GLOBAL__N_1UlvE8_EEENS5_6__anonEEEJNS_5__env9empty_envEEEEDcT0_OT1_DpRKT2_' as another definition
  103 |         operator()(_Domain __dom, _Sender&& __sndr, const _Env&... __env) const
      |         ^
/tmp/build/vcpkg_installed/x64-linux-clang/include/exec/../stdexec/__detail/__transform_sender.hpp:103:9: note: previous definition is here

I'm not an experienced modules user, so I can easily be wrong, but I don't see anything wrong in terms of linkage/ODR/etc. And based on #53232 it seems, that this error is in fact internal to compiler.

Here is compiler version (it was installed from the LLVM APT repository):

$ clang++-19 --version
Ubuntu clang version 19.1.5 (++20241125105251+086d8e6bb5da-1~exp1~20241125105305.67)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
llvmbot commented 3 days ago

@llvm/issue-subscribers-clang-modules

Author: Mikail Bagishov (MikailBag)

My code: https://gist.github.com/MikailBag/5803041040c052deda1d06893eae67e1 (Please note that is requires stdexec, which is AFAIK reference implementation of the C++26 `std::execution`) When running `build.sh`, I get following error: ``` /tmp/build/vcpkg_installed/x64-linux-clang/include/exec/../stdexec/__detail/__transform_sender.hpp:103:9: error: definition with same mangled name '_ZNK7stdexec8__domain18__transform_senderclIS1_NS_14default_domainENS_7__sexprIXtlNS_12_GLOBAL__N_1UlvE8_EEENS5_6__anonEEEJNS_5__env9empty_envEEEEDcT0_OT1_DpRKT2_' as another definition 103 | operator()(_Domain __dom, _Sender&& __sndr, const _Env&... __env) const | ^ /tmp/build/vcpkg_installed/x64-linux-clang/include/exec/../stdexec/__detail/__transform_sender.hpp:103:9: note: previous definition is here ``` I'm not an experienced modules user, so I can easily be wrong, but I don't see anything wrong in terms of linkage/ODR/etc. And based on #53232 it seems, that this error is in fact internal to compiler. Here is compiler version (it was installed from the LLVM APT repository): ``` $ clang++-19 --version Ubuntu clang version 19.1.5 (++20241125105251+086d8e6bb5da-1~exp1~20241125105305.67) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/lib/llvm-19/bin ```