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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 13:54:12  来源:igfitidea点击:

What's the status of C++17 support in GCC?

c++gccclang++

提问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.

感谢 @JanVanDijk 提供完整功能表链接

回答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 日):

  • autofor 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
  • typenamefor template template parameters since 5.1.0
  • new deduction rules for direct-list-initialization since 5.1.0
  • static_assertwithout a message in HEAD
  • u8character literals in HEAD
  • Attributes for namespaces or enumerators in 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 上还有一个很好的表格,列出了几种编译器支持的功能。

http://en.cppreference.com/w/cpp/compiler_support

http://en.cppreference.com/w/cpp/compiler_support