繁体   English   中英

Clang ++ -fmodules在#include之后使用类型的错误<cstdint>

[英]Clang++ -fmodules errors using types after #include <cstdint>

当使用-fmodules进行编译时,使用以下所示的命令,以下简单的测试用例文件为我提供了Clang的github镜像中“ master”提示的编译时错误。 我想知道这是否是针对Clang的新实验性模块功能的错误-可能是标准库的模块映射的实现存在问题-还是我做错了什么。 如果将-fbuiltin-module-map添加到命令中,该错误仍然会出现。 有趣的是,如果我用stdint.h代替cstdint ,则错误不再出现。

#include <stdint.h>
uint64_t foo;

这是我的编译命令,并带有错误消息:

anhall@leviathan: /Users/anhall/impersonal/code/llvm-reflexpr/install/bin/clang++ -o module-uint64_t-test.o -c module-uint64_t-test.cpp --std=c++1z -fmodules
module-uint64_t-test.cpp:3:1: error: missing '#include <_types/_uint64_t.h>'; declaration of 'uint64_t' must be imported from module 'Darwin.POSIX._types._uint64_t' before it is
      required
uint64_t foo;
^
/usr/include/_types/_uint64_t.h:31:28: note: previous declaration is here
typedef unsigned long long uint64_t;

我正在使用的构建信息:来自Matus Chochlik的github Clang镜像的分支; 但我将其设置为与原始clang git镜像中(当时)“ master”的头(当时)相对应的提交(换句话说,它不包括来自Matus Chochlik的功能“ reflexpr”分支的提交):

anhall@leviathan: /Users/anhall/impersonal/code/llvm-reflexpr/install/bin/clang++ -v
clang version 4.0.0 (https://github.com/matus-chochlik/clang.git 1fa85026bfc23f5cda0b89598bd2056b817ae9d4) (https://github.com/llvm-mirror/llvm.git 069db88a3b2cae52023664fdd30378d3adc26566)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Users/anhall/impersonal/code/llvm-reflexpr/install/bin

(注意:怀疑这是一个错误,我也已通过电子邮件将上述报告发送给LLVM管理员,并打算将其报告给LLVM Bugzilla,如果他们回答并给我登录。但是我想我也将其张贴在这里,如果这是我弄错了,或者是对使用Clang C ++ 1z +模块支持的任何人都感兴趣的话)

编辑1:

如果将-v添加到编译命令行,则表明它确实在搜索我的版本的include目录,而不是其他Clang版本的目录,例如:

#include "..." search starts here:
#include <...> search starts here:
 /Users/anhall/impersonal/code/llvm-reflexpr/install/bin/../include/c++/v1
 /usr/local/include
 /Users/anhall/impersonal/code/llvm-reflexpr/install/bin/../lib/clang/4.0.0/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.

我不知道问题是否可能是我的Clang版本的标头与/usr/local/include/usr/include的OS X系统标头之间的相互作用

这是我在r287690中修复的libc ++中的问题。 如果您更新自定义Clang / libc ++安装,则应解决这些问题。

在过去的一个月中,我已经解决了使用libc ++和模块的问题。 我实际上只有昨天启用了模块的所有libc ++测试都通过了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM