GCC 中 C++17 支持的状态如何?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31230201/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What's the status of C++17 support in GCC?
提问by einpoklum
Clang has a nice pagedescribing the project status w.r.t. C++1z/C++17 feature support (and C++11 and C++14, it's the same page).
Clang 有一个很好的页面描述了与 C++1z/C++17 功能支持有关的项目状态(以及 C++11 和 C++14,这是同一页面)。
g++ has a page regarding C++14 features, but I couldn't find anything about C++17/C++1z. Is that being worked on but just not present on the web? For version 5.0?
g++ 有一个关于 C++14 features 的页面,但我找不到关于 C++17/C++1z 的任何信息。这是否正在处理中,但只是没有出现在网络上?对于 5.0 版?
采纳答案by einpoklum
Updated final nutshell answer:
更新的最终简而言之答案:
- GCC 8.x (and later) fully supports all of C++17.
- GCC 7.x supports all of C++17 except for class template argument deduction.
- GCC 6.x (and earlier) has little or no support for C++17 features.
- GCC 8.x(及更高版本)完全支持所有 C++17。
- GCC 7.x 支持除类模板参数推导之外的所有 C++17。
- GCC 6.x(及更早版本)几乎不支持 C++17 特性。
Thanks @JanVanDijk for the link to the full feature table.
回答by Jan van Dijk
As of today, gcc's C++1z language support is tracked on: https://gcc.gnu.org/projects/cxx1z.html. For the C++1z status of libstdc++, see https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.201z.
截至今天,gcc 的 C++1z 语言支持在以下网址进行跟踪:https: //gcc.gnu.org/projects/cxx1z.html。有关 libstdc++ 的 C++1z 状态,请参阅https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.201z。
回答by Columbo
There is some support already; The following two summaries are oriented on Clang's list:
已经有一些支持;以下两个摘要面向 Clang 的列表:
Supported (as of July 5th, 2015):
支持(截至 2015 年 7 月 5 日):
auto
for function parameters is supported since 4.9. This feature is currently considered an extension but is included in the concepts proposal and called "generic functions".- trigraphs are being ignored by default since 5.1.0
typename
for template template parameters since 5.1.0- new deduction rules for direct-list-initialization since 5.1.0
static_assert
without a message in HEADu8
character literals in HEAD- Attributes for namespaces or enumerators in HEAD
auto
自 4.9 起支持 for 函数参数。此功能目前被认为是一个扩展,但包含在概念提案中并称为“通用功能”。- 自 5.1.0 以来,默认情况下会忽略三合字母
typename
自 5.1.0 起用于模板模板参数- 自 5.1.0 以来直接列表初始化的新扣除规则
static_assert
在 HEAD 中没有消息u8
HEAD 中的字符文字- HEAD 中命名空间或枚举器的属性
Unsupported (as of July 5th, 2015; with links to a valid example usage):
不受支持(截至 2015 年 7 月 5 日;带有指向有效示例用法的链接):
For the status of implementation of library proposals in libstdc++, the corresponding manualhas a list.
对于libstdc++中图书馆提案的实施情况,相应的手册有一个列表。
回答by BoshWash
There is also a nice table at cppreference.com that lists supported features for several compilers.
cppreference.com 上还有一个很好的表格,列出了几种编译器支持的功能。