Compiler support for C++17
From cppreference.net
<
cpp
|
compiler support
*
- 将鼠标悬停在标有星号
*
的单元格上可查看附加弹出注释。
DR
nn
- "DR" 后的数字
nn
表示缺陷报告所适用的目标 C++ 修订版本,例如 DR20 → C++20。
C++17 核心语言特性
|
C++17 feature
|
Paper(s)
|
GCC
|
Clang
|
MSVC
|
Apple Clang
|
EDG eccp
|
Intel C++
|
Nvidia HPC C++ (ex PGI)*
|
Nvidia nvcc
|
Cray
|
Embarcadero C++ Builder
|
IBM Open XL C++ for AIX
|
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| DR11: New auto rules for direct-list-initialization | N3922 | 5 | 3.8 | 19.0 (2015)* | Yes | 4.10.1 | 17.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| typename in a template template parameter | N4051 | 5 | 3.5 | 19.0 (2015)* | Yes | 4.10.1 | 17.0 | 17.7 | Yes* | 11.0 | 10.3 | 17.1.0 | |
| Removing trigraphs | N4086 | 5 | 3.5 | 16.0* | Yes | 5.0 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | ||
| Nested namespace definition | N4230 | 6 | 3.6 | 19.0 (Update 3)* | Yes | 4.12 | 17.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| static_assert with no message ( FTM ) * | N3928 | 6 | 2.5 | 19.10* | Yes | 4.12 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Attributes for namespaces and enumerators ( FTM ) * ( FTM ) * | N4266 |
4.9 (partial)*
6 |
3.6 | 19.0 (2015)* | Yes | 4.11 | 17.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
u8
character literals
|
N4267 | 6 | 3.6 | 19.0 (2015)* | Yes | 4.11 | 17.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Allow constant evaluation for all constant template arguments ( FTM ) * | N4268 | 6 | 3.6 | 19.12* | Yes | 5.0 | 19.0.1 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Unary fold expressions and empty parameter packs | P0036R0 | 6 | 3.9 | 19.12* | Yes | 4.14 | 19.0 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Remove deprecated use of the register keyword | P0001R1 | 7 | 3.8 | 19.11* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Remove deprecated operator ++ ( bool ) | P0002R1 | 7 | 3.8 | 19.11* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Make exception specifications part of the type system ( FTM ) * | P0012R1 | 7 | 4 | 19.12* | Yes | 4.14 | 19.0 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| __has_include in preprocessor conditionals | P0061R1 | 5 | Yes | 19.11* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| DR11: New specification for inheriting constructors ( DR1941 et al) ( FTM ) * | P0136R1 | 7 | 3.9 | 19.14* * | Yes | 6.1 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | ||
| Aggregate classes with base classes ( FTM ) * | P0017R1 | 7 | 3.9 | 19.14* | Yes | 5.0 | 19.0.1 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Fold Expressions ( FTM ) * | N4295 | 6 | 3.6 | 19.12* | Yes | 4.14 | 19.0 | 18.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Lambda capture of * this ( FTM ) * | P0018R3 | 7 | 3.9 | 19.11* | Yes | 4.14 | 19.0 | 18.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Direct-list-initialization of enumerations | P0138R2 | 7 | 3.9 | 19.11* | Yes | 4.14 | 18.0 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
constexpr
lambda expressions
(
FTM
)
*
|
P0170R1 | 7 | 5 | 19.11* | Yes | 4.14 | 19.0 | 18.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Differing begin and end types in range-based for ( FTM ) * | P0184R0 | 6 | 3.9 | 19.10* | Yes | 4.12 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
[[
fallthrough
]]
attribute
|
P0188R1 | 7 | 3.9 | 19.10* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
[[
nodiscard
]]
attribute
|
P0189R1 | 7 | 3.9 | 19.11* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
[[
maybe_unused
]]
attribute
|
P0212R1 | 7 | 3.9 | 19.11* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Hexadecimal floating-point literals ( FTM ) * | P0245R1 | 3.0 | Yes | 19.11* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Using attribute namespaces without repetition | P0028R4 | 7 | 3.9 | 19.11* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Dynamic memory allocation for over-aligned data ( FTM ) * | P0035R4 | 7 | 4 | 19.12* | 10.0.0* | 4.14 | 19.0 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Constant template parameters with auto type ( FTM ) * | P0127R2 | 7 | 4 | 19.14* | Yes | 5.0 | 19.0.1 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Guaranteed copy elision ( FTM ) * | P0135R1 | 7 | 4 | 19.13* | Yes | 5.0 | 19.0.1 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Replacement of class objects containing reference members | P0137R1 | 7 | 6 | 19.14* | Yes | 5.0 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | ||
| Stricter expression evaluation order | P0145R3 | 7 | 4 | 19.14* | Yes | 5.0 | 19.0.1 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Structured Bindings ( FTM ) * | P0217R3 | 7 | 4 | 19.11* | Yes | 4.14 | 19.0 | 18.1 | 11.0* | 11.0 | 10.3 | 17.1.0 | |
| Ignore unknown attributes | P0283R2 | Yes | 3.9 | 19.0 (2015)* | Yes | 4.13 | 18.0 | 17.7 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| constexpr if statements ( FTM ) * | P0292R2 | 7 | 3.9 | 19.11* | Yes | 4.14 | 19.0 | 18.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Init-statements for if and switch | P0305R1 | 7 | 3.9 | 19.11* | Yes | 4.14 | 18.0 | 18.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Inline variables ( FTM ) * | P0386R2 | 7 | 3.9 | 19.12* | Yes | 4.14 | 19.0 | 18.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Removing dynamic exception specifications | P0003R5 | 7 | 4 | 19.12* | Yes | 4.14 | 19.0 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Pack expansions in using-declarations ( FTM ) * | P0195R2 | 7 | 4 | 19.14* | Yes | 5.0 | 19.0 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| DR98: Matching of template template-arguments excludes compatible templates ( FTM ) * | P0522R0 | 7 | 4 | 19.12* | Yes | 5.0 | 19.0.1 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
| Class template argument deduction ( FTM ) * | P0091R3 | 7 | 5 | 19.14* | Yes | 5.0 | 19.0.1 | 19.1 | 11.0 | 11.0 | 10.3 | 17.1.0 | |
|
C++17 feature |
Paper(s) |
GCC
|
Clang
|
MSVC
|
Apple Clang
|
EDG eccp
|
Intel C++
|
Nvidia HPC C++ (ex PGI)*
|
Nvidia nvcc
|
Cray
|
Embarcadero C++ Builder
|
IBM Open XL C++ for AIX
|
C++17 库特性
|
C++17 feature
|
Paper(s)
|
GCC libstdc++
|
Clang libc++
|
MSVC STL
|
Apple Clang*
|
IBM Open XL C/C++ for AIX*
|
Intel Parallel STL
|
Embarcadero C++ Builder*
|
|
|---|---|---|---|---|---|---|---|---|---|
| std::void_t ( FTM ) * | N3911 | 6.1 | 3.6 | 19.0 (2015)* | Yes | 17.1.0 | N/A | 10.3 | |
| std::uncaught_exceptions() ( FTM ) * | N4259 | 6.1 | 3.7 | 19.0 (2015)* | Yes | 17.1.0 | N/A | 10.3 | |
| std::size() , std::empty() and std::data() ( FTM ) * | N4280 | 6 | 3.6 | 19.0 (2015)* | Yes | 17.1.0 | N/A | 10.3 | |
| std::allocator_traits::is_always_equal , noexcept cleanups ( FTM ) * | N4258 | 6.1 | 3.7 | 19.0 (2015)* | 17.1.0 | N/A | |||
| std::invoke ( FTM ) * | N4169 | 6.1 | 3.7 | 19.0 (2015)* | Yes | 17.1.0 | N/A | ||
| std::map::try_emplace , std::map::insert_or_assign ( FTM ) * | N4279 | 6.1 | 3.7 | 19.0 (2015)* | Yes | 17.1.0 | N/A | ||
| std::unordered_map::try_emplace , std::unordered_map::insert_or_assign ( FTM ) * | N4279 | 6.1 | 3.7 | 19.0 (2015)* | Yes | 17.1.0 | N/A | ||
| Improving std::pair and std::tuple | N4387 | 6.1 | 4 | 19.0 (Update 2)* | Yes | 17.1.0 | N/A | 10.3 | |
| std::bool_constant ( FTM ) * | N4389 | 6.1 | 3.7 | 19.0 (2015)* | Yes | 17.1.0 | N/A | 10.3 | |
| std::shared_mutex (untimed) ( FTM ) * | N4508 | 6 | 3.7 | 19.0 (Update 2)* | Yes | 17.1.0 | N/A | 10.3 | |
| Minimal incomplete type support for std::forward_list , std::list , and std::vector ( FTM ) * | N4510 | 3.0 | 3.6 | 18.0* | Yes | 17.1.0 | N/A | ||
| Type traits variable templates ( FTM ) * | P0006R0 | 7.1 | 3.8 | 19.0 (Update 2)* | Yes | 17.1.0 | N/A | 10.3 | |
| Logical operator type traits ( FTM ) * | P0013R1 | 6.1 | 3.8 | 19.0 (Update 2)* | Yes | 17.1.0 | N/A | 10.3 | |
| std::as_const ( FTM ) * | P0007R1 | 7.1 | 3.8 | 19.0 (Update 2)* | Yes | 17.1.0 | N/A | ||
| Rounding functions for std::chrono::duration and std::chrono::time_point ( FTM ) * | P0092R1 | 7.1 | 3.8 | 19.0 (Update 2)* | Yes | 17.1.0 | N/A | ||
| Transparent std::owner_less ( std::owner_less<void> ) ( FTM ) * | P0074R0 | 7.1 | 3.8 | 19.0 (Update 2)* | Yes | 17.1.0 | N/A | ||
| std::not_fn ( FTM ) * |
P0005R4
P0358R1 |
7.1 | 3.9 | 19.12* | Yes | 17.1.0 | N/A | 10.3 | |
| Parallel algorithms and execution policies ( FTM ) * ( FTM ) * | P0024R2 | 9* |
17
(partial)* |
19.14* | 18.0* | ||||
| std::clamp() ( FTM ) * | P0025R1 | 7 | 3.9 | 19.0 (Update 3)* | 10.0.0* | 17.1.0 | N/A | 10.3 | |
| (nothrow-)swappable traits ( FTM ) * | P0185R1 | 7.1* | 3.9 | 19.0 (Update 3)* | 10.0.0* | 17.1.0 | N/A | 10.3 | |
| Polymorphic memory resources ( FTM ) * | P0220R1 | 9.1 | 16 | 19.13* | 15.0.0* | 17.1.1 | N/A | 10.3 | |
| std::apply ( FTM ) * | P0220R1 | 7.1 | 16 | 19.13* | Yes | 17.1.0 | N/A | ||
| Searchers ( FTM ) * | P0220R1 | 7.1 | 16 | 19.13* | Yes | 17.1.0 | N/A | ||
| std::sample ( FTM ) * | P0220R1 | 7.1 | 16 | 19.13* | Yes | 17.1.0 | N/A | ||
| Mathematical special functions ( FTM ) * | P0226R1 | 7 | 19.14* | 17.1.1 | N/A | 10.3 | |||
| constexpr std::addressof ( FTM ) * | LWG2296 | 7.1 | Yes | 19.0 (Update 3)* | 17.1.0 | N/A | |||
| constexpr for std::reverse_iterator , std::move_iterator , std::array and range access ( FTM ) * | P0031R0 | 7.1 | 4 | 19.11* | Yes | 17.1.0 | N/A | ||
| constexpr std:: atomic < T > :: is_always_lock_free ( FTM ) * | P0152R1 | 7.1 | 3.9 | 19.11* | Yes | 17.1.0 | N/A | ||
| std::enable_shared_from_this::weak_from_this ( FTM ) * | P0033R1 | 7.1 | 3.9 | 19.12* | Yes | 17.1.0 | N/A | ||
| 3-argument overload of std::hypot ( FTM ) * | P0030R1 | 7.1 | 3.9 | 19.14* | Yes | 17.1.0 | N/A | ||
| std::byte ( FTM ) * | P0298R3 | 7 | 5 | 19.11* | Yes | 17.1.1 | N/A | 10.3 | |
| std::string_view ( FTM ) * |
N3921
P0220R1 P0254R2 P0403R1 |
7.1 | 4 |
19.10*
(partial)*
19.11* * |
10.0.0* | 17.1.0 | N/A | 10.3 | |
| std::any ( FTM ) * |
P0220R1
P0032R3 |
7.1 | 4 | 19.10* | 10.0.0* | 17.1.0 | N/A | 10.3 | |
| std::optional ( FTM ) * | P0220R1 | 7.1 | 4 | 19.10* | 10.0.0* | 17.1.0 | N/A | 10.3 | |
| Major portion of C11 standard library | P0063R3 | 9.1 | 7 |
19.0 (2015)*
(partial)* |
10.0.0* | 17.1.1 | N/A | ||
| Splicing Maps and Sets ( FTM ) * | P0083R3 | 7 | 8 | 19.12* | 10.0.0* | 17.1.1 | N/A | ||
| return type of emplace * functions of some containers changed from void to reference | P0084R2 | 7.1 | 4.0 | 19.11* | Yes | 17.1.0 | N/A | ||
| std::variant ( FTM ) * | P0088R3 | 7.1 | 4 | 19.10* | 10.0.0* | 17.1.0 | N/A | 10.3 | |
| std::make_from_tuple() ( FTM ) * | P0209R2 | 7.1 | 3.9 | 19.10* | Yes | 17.1.0 | N/A | 10.3 | |
| std::has_unique_object_representations ( FTM ) * | P0258R2 | 7.1 | 6 | 19.11* | Yes | 17.1.1 | N/A | 10.3 | |
| std::gcd() and std::lcm() ( FTM ) * | P0295R0 | 7 | 4 | 19.11* | Yes | 17.1.0 | N/A | 10.3 | |
| CWG issue 1776 : Replacement of class objects containing reference members ( std::launder ) ( FTM ) * | P0137R1 | 7.1 | 6 | 19.14* | Yes | 17.1.0 | N/A | ||
| Extending memory management tools ( FTM ) * | P0040R3 | 7.1 | 4 | 19.11* | 17.1.0 | N/A | |||
| shared_ptr::weak_type ( FTM ) * | P0163R0 | 7.1 | 3.9 | 19.10* | Yes | 17.1.0 | N/A | ||
| Elementary string conversions : std:: to_chars / std:: from_chars ( FTM ) * | P0067R5 |
8*
11 |
7*
14* 20* |
19.14*
*
19.24* |
10.0.0* * | 17.1.1* | N/A | 10.3* | |
| std::shared_ptr and std::weak_ptr with array support | P0414R2 | 7 | 11 | 19.12* | 12.0.0* | 17.1.1 | N/A | 10.3 | |
| Constexpr for all the member functions of std::chrono::duration and std::chrono::time_point ( FTM ) * | P0505R0 | 7.1 | 4 | 19.11* | Yes | 17.1.1 | N/A | ||
| std:: shared_ptr < T [ ] > ( FTM ) * | P0497R0 | 7.1 | 11 | 19.12* | 17.1.1 | N/A | |||
| constexpr std::char_traits ( FTM ) * | P0426R1 | 8.1 | 4 | 19.14* | Yes | 17.1.1 | N/A | ||
| File system library ( std::filesystem ) ( FTM ) * |
P0218R1
P0219R1 |
8 | 7 | 19.14* | 11.0.0* | 17.1.1 | N/A | 10.3 | |
| Hardware interference size ( FTM ) * | P0154R1 | 12.1 |
15 (partial)*
19 |
19.11* | N/A | 10.3 | |||
| std::scoped_lock ( FTM ) * | P0156R2 | 7 | 5 | 19.11* | Yes | 17.1.1 | N/A | 10.3 | |
| std::is_aggregate ( FTM ) * | LWG2911 | 7 | 5 | 19.15* | Yes | 17.1.1 | N/A | 10.3 | |
| std::is_invocable , std::invoke_result ( FTM ) * | P0604R0 | 7.1 | Yes | 19.11* | Yes | 17.1.1 | N/A | ||
| DR17: std::hash<std::filesystem::path> | LWG3657 | 11.4 | 17 | 19.32* | N/A | ||||
|
C++17 feature |
Paper(s) |
GCC libstdc++
|
Clang libc++
|
MSVC STL
|
Apple Clang*
|
IBM Open XL C/C++ for AIX*
|
Intel Parallel STL
|
Embarcadero C++ Builder*
|
注释
- 截至2020年11月20日,Oracle Developer Studio 最新版本为12.6 。其 文档 未提及C++17支持。
- Cray编译器可能在11.0版本之前已支持部分特性。该版本标志着它成为Clang的衍生版本,继承了基础编译器的全部语言特性支持。详见 Cray/HPE文档S-2179 。