Clang ++ -fmodules在#include< cstdint>之后使用类型的错误; [英] Clang++ -fmodules errors using types after #include <cstdint>

查看:189
本文介绍了Clang ++ -fmodules在#include< cstdint>之后使用类型的错误;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

The following simple test case file is giving me a compile-time error with the tip of 'master' from Clang's github mirror, when compiled with -fmodules, using the command shown below. I'm wondering if this is a bug with the new experimental Module feature for Clang -- maybe a problem with the implementation of module maps for the standard library -- or if there's something I'm doing wrong. The error still appears if I add -fbuiltin-module-map to the command. Interestingly, the error no longer appears if I substitute stdint.h for cstdint.

#include <stdint.h>
uint64_t foo;

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

Here's my compile command, with the error message:

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分支的提交):

Information on the build I'm using: It's from Matus Chochlik's fork of the github Clang mirror; but I'm set to the commit that corresponds to the (at the time) head of 'master' in the original clang git mirror (in other words, it does not include commits from Matus Chochlik's feature 'reflexpr' branch):

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 ++ 1的任何人都感兴趣z +模块支持)

(Note: suspecting this is a bug, I have also emailed the above report to the LLVM Administrators and intend to file it at the LLVM Bugzilla if they reply and give me a login. But I thought I'd post it here as well, in case it's something I'm getting wrong, or is interesting to anyone working with Clang's C++1z+ modules support)

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

If I add the -v to the compile command-line, it shows that it is indeed searching my build's include directories, not those of another build of Clang, for example:

#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版本的标头和OS X之间的相互作用 / usr / local / include / usr / include

I don't know if the issue could be an interaction between my Clang build's headers and the OS X system headers in /usr/local/include and /usr/include

推荐答案

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

This was an issue in libc++ which I fixed in r287690. If you update your custom Clang/libc++ installation these issues should be fixed.

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

Over the past month I've fixed a number of issues using libc++ with modules. I literally only got all of the libc++ tests passing yesterday with modules enabled.

这篇关于Clang ++ -fmodules在#include&lt; cstdint&gt;之后使用类型的错误;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆