[英]C++20 modules on clang (Windows): typeinfo error in simplest example
File first_module.cppm
文件
first_module.cppm
export module first_module;
int foo(int x) {
return x;
}
export int e = 42;
export int bar() {
return foo(e);
}
Pre-compiling (no problems):预编译(没问题):
$ clang++ --std=c++20 -fmodules --precompile first_module.cppm -o first_module.pcm
Compiler information:编译器信息:
$ clang++ -v
clang version 10.0.0
Target: x86_64-pc-windows-msvc
File first-main.cc
文件
first-main.cc
import first_module;
int main() {
return bar();
}
Compiling (no problems):编译(没问题):
$ clang++ --std=c++20 -fmodules first-main.cc -fmodule-file=first_module.pcm first_module.pcm
Everything is ok.一切都好。
File second-main.cc
文件
second-main.cc
import first_module;
#include <iostream>
int main() {
std::cout << bar() << std::endl;
}
Compiling same way:编译方式相同:
$ clang++ --std=c++20 -fmodules second-main.cc -fmodule-file=first_module.pcm first_module.pcm
Result: ton of errors like:结果:大量错误,例如:
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.26.28801\include\eh.h:56:14: error: reference to 'type_info' is ambiguous
_In_ type_info const& _Type,
^
note: candidate found by name lookup is 'type_info'
note: candidate found by name lookup is 'type_info'
I have feeling that I am doing something wrong, because I have newest MSVS (updated recently), newest clang, but something still not working on Windows on trivial examples.我觉得我做错了什么,因为我有最新的 MSVS(最近更新),最新的 clang,但在 Windows 上的一些琐碎示例仍然无法正常工作。
Or may be this is known bug?或者这可能是已知的错误? Tried to google it, no results.
试着google了一下,没有结果。
The core problem resides in that your current Clang
installation it's working with the MSVC
toolchain and there's a known issue when you compile using #include
directives with the Microsoft toolchain with Clang
using the modules
feature.核心问题在于您当前的
Clang
安装它正在使用MSVC
工具链,并且当您使用带有 Microsoft 工具链的#include
指令和Clang
使用modules
功能进行编译时,存在一个已知问题。
You can find it here, opened since 2018 https://github.com/llvm/llvm-project/issues/38400你可以在这里找到它,自 2018 年以来打开https://github.com/llvm/llvm-project/issues/38400
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.