Difference between revisions of "多种编译器对C++17的支持"
From KlayGE
Gongminmin (Talk | contribs) |
Gongminmin (Talk | contribs) |
||
(6 intermediate revisions by one user not shown) | |||
Line 4: | Line 4: | ||
! 功能 !! 提案 !! MSVC !! GCC !! ICC !! Clang !! 替代方案 | ! 功能 !! 提案 !! MSVC !! GCC !! ICC !! Clang !! 替代方案 | ||
|- | |- | ||
− | | static_assert with no message || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3928.pdf N3928] || {{ | + | | static_assert with no message || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3928.pdf N3928] || {{Yes}}15.0 || {{Yes}}6 || {{No}}No || {{Yes}}3.5 || C++11's static_assert |
|- | |- | ||
− | | Disabling trigraph expansion by default || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4086.html N4086] || {{Yes}}12.0 || {{ | + | | Disabling trigraph expansion by default || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4086.html N4086] || {{Yes}}12.0 || {{Yes}}5.1 || {{No}}No || {{Yes}}3.5 || |
|- | |- | ||
− | | typename in a template template parameter || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4051.html N4051] || {{Yes}}14.0 || {{ | + | | typename in a template template parameter || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4051.html N4051] || {{Yes}}14.0 || {{Yes}}5 || {{Yes}}17.0 || {{Yes}}3.5 || |
|- | |- | ||
− | | New auto rules for direct-list-initialization || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3922.html N3922] || {{Yes}}14.0 || {{ | + | | New auto rules for direct-list-initialization || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3922.html N3922] || {{Yes}}14.0 || {{Yes}}5 || {{Yes}}17.0 || {{Yes}}3.8 || |
|- | |- | ||
− | | Fold expressions || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4295.html N4295] || {{No}}No || {{ | + | | Fold expressions || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4295.html N4295] || {{No}}No || {{Yes}}6 || {{No}}No || {{Yes}}3.6 || |
|- | |- | ||
− | | Attributes for namespaces and enumerators || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4266.html N4266] || {{Yes}}14.0 || {{ | + | | Attributes for namespaces and enumerators || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4266.html N4266] || {{Yes}}14.0 || {{Yes}}6 || {{No}}No || {{Yes}}3.6 || |
|- | |- | ||
− | | u8 character literals || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4267.html N4267] || {{Yes}}14.0 || {{ | + | | u8 character literals || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4267.html N4267] || {{Yes}}14.0 || {{Yes}}6 || {{Yes}}17.0 || {{Yes}}3.6 || |
|- | |- | ||
− | | Nested namespace definition || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4230.html N4230] || {{ | + | | Nested namespace definition || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4230.html N4230] || {{Yes}}15.0 || {{Yes}}6 || {{Yes}}17.0 || {{Yes}}3.6 || |
|- | |- | ||
− | | Allow constant evaluation for all non-type template arguments || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4268.html N4268] || {{No}}No || {{No}}No || {{No}}No || {{Yes}}3.6 || | + | | Allow constant evaluation for all non-type template arguments || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4268.html N4268] || {{No}}No || {{Yes}}6 || {{No}}No || {{Yes}}3.6 || |
+ | |- | ||
+ | | Remove deprecated register storage class || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0001r1.html P0001R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.8 || | ||
+ | |- | ||
+ | | Remove deprecated bool increment || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0002r1.html P0002R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.8 || | ||
+ | |- | ||
+ | | Make exception specifications part of the type system || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html P0012R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | __has_include in preprocessor conditionals || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0061.html P0061R1] || {{No}}No || {{Yes}}5 || {{No}}No || {{Yes}}Yes || | ||
+ | |- | ||
+ | | New specification for inheriting constructors (DR1941 et al) || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0136r1.html P0136R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | <nowiki>[[fallthrough]]</nowiki> attribute || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0188r1.pdf P0188R1] || {{Yes}}15.0 || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | <nowiki>[[nodiscard]]</nowiki> attribute || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0189r1.pdf P0189R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | <nowiki>[[maybe_unused]]</nowiki> attribute || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0212r1.pdf P0212R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Aggregate initialization of classes with base classes || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0017r1.html P0017R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | constexpr lambda expressions || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0170r1.pdf P0170R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Unary Folds and Empty Parameter Packs || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0036r0.pdf P0036R0] || {{No}}No || {{Yes}}6 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Differing begin and end types in range-based for || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0184r0.html P0184R0] || {{Yes}}15.0 || {{Yes}}6 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Lambda capture of *this || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0018r3.html P0018R3] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Direct-list-initialization of enums || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0138r2.pdf P0138R2] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Hexadecimal floating-point literals || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0245r1.html P0245R1] || {{No}}No || {{Yes}}3.0 || {{No}}No || {{Yes}}Yes || | ||
+ | |- | ||
+ | | Using attribute namespaces without repetition || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0028r4.html P0028R4] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Dynamic memory allocation for over-aligned data || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0035r4.html P0035R4] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Template argument deduction for class templates || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0091r3.html P0091R3] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Non-type template parameters with auto type || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0127r2.html P0127R2] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Guaranteed copy elision || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0135r1.html P0135R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Stricter expression evaluation order || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0145r3.pdf P0145R3] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Requirement to ignore unknown attributes || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0283r2.html P0283R2] || {{No}}No || {{Yes}}Yes || {{No}}No || {{Yes}}Yes || | ||
+ | |- | ||
+ | | constexpr if-statements || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0292r2.html P0292R2] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Inline variables || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0386r2.pdf P0386R2] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Structured bindings || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0217r3.html P0217R3] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Separate variable and condition for if and switch || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0305r1.html P0305R1] || {{No}}No || {{Yes}}7 || {{No}}No || {{Yes}}3.9 || | ||
+ | |- | ||
+ | | Matching template template parameters to compatible arguments || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0522r0.html P0522R0] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Removing deprecated dynamic exception specifications || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0003r5.html P0003R5] || {{No}}No || {{Yes}}7 || {{No}}No || {{No}}No || | ||
+ | |- | ||
+ | | Pack expansions in using-declarations || [http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0195r2.html P0195R2] || {{No}}No || {{No}}No || {{No}}No || {{No}}No || | ||
|} | |} | ||
Line 30: | Line 88: | ||
== 参考 == | == 参考 == | ||
*[http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx C++11/14/17 Features In VS 2015 RTM] | *[http://blogs.msdn.com/b/vcblog/archive/2015/06/19/c-11-14-17-features-in-vs-2015-rtm.aspx C++11/14/17 Features In VS 2015 RTM] | ||
+ | *[https://blogs.msdn.microsoft.com/vcblog/2016/10/07/compiler-tools-layout-in-visual-studio-15/ C++14/17 Features and STL Fixes in VS “15” Preview 5] | ||
+ | *[https://gcc.gnu.org/projects/cxx-status.html C++ Standards Support in GCC] | ||
*[http://clang.llvm.org/cxx_status.html C++ Support in Clang] | *[http://clang.llvm.org/cxx_status.html C++ Support in Clang] | ||
+ | *[https://software.intel.com/en-us/articles/c17-features-supported-by-intel-c-compiler C++17 Features Supported by Intel® C++ Compiler] | ||
[[Category:知识库]] | [[Category:知识库]] | ||
[[en:C++17 support in compilers]] | [[en:C++17 support in compilers]] |
Latest revision as of 01:18, 2 January 2017
C++17核心语言功能
功能 | 提案 | MSVC | GCC | ICC | Clang | 替代方案 |
---|---|---|---|---|---|---|
static_assert with no message | N3928 | 15.0 | 6 | No | 3.5 | C++11's static_assert |
Disabling trigraph expansion by default | N4086 | 12.0 | 5.1 | No | 3.5 | |
typename in a template template parameter | N4051 | 14.0 | 5 | 17.0 | 3.5 | |
New auto rules for direct-list-initialization | N3922 | 14.0 | 5 | 17.0 | 3.8 | |
Fold expressions | N4295 | No | 6 | No | 3.6 | |
Attributes for namespaces and enumerators | N4266 | 14.0 | 6 | No | 3.6 | |
u8 character literals | N4267 | 14.0 | 6 | 17.0 | 3.6 | |
Nested namespace definition | N4230 | 15.0 | 6 | 17.0 | 3.6 | |
Allow constant evaluation for all non-type template arguments | N4268 | No | 6 | No | 3.6 | |
Remove deprecated register storage class | P0001R1 | No | 7 | No | 3.8 | |
Remove deprecated bool increment | P0002R1 | No | 7 | No | 3.8 | |
Make exception specifications part of the type system | P0012R1 | No | 7 | No | No | |
__has_include in preprocessor conditionals | P0061R1 | No | 5 | No | Yes | |
New specification for inheriting constructors (DR1941 et al) | P0136R1 | No | 7 | No | 3.9 | |
[[fallthrough]] attribute | P0188R1 | 15.0 | 7 | No | 3.9 | |
[[nodiscard]] attribute | P0189R1 | No | 7 | No | 3.9 | |
[[maybe_unused]] attribute | P0212R1 | No | 7 | No | 3.9 | |
Aggregate initialization of classes with base classes | P0017R1 | No | 7 | No | 3.9 | |
constexpr lambda expressions | P0170R1 | No | 7 | No | No | |
Unary Folds and Empty Parameter Packs | P0036R0 | No | 6 | No | 3.9 | |
Differing begin and end types in range-based for | P0184R0 | 15.0 | 6 | No | 3.9 | |
Lambda capture of *this | P0018R3 | No | 7 | No | 3.9 | |
Direct-list-initialization of enums | P0138R2 | No | 7 | No | 3.9 | |
Hexadecimal floating-point literals | P0245R1 | No | 3.0 | No | Yes | |
Using attribute namespaces without repetition | P0028R4 | No | 7 | No | 3.9 | |
Dynamic memory allocation for over-aligned data | P0035R4 | No | 7 | No | No | |
Template argument deduction for class templates | P0091R3 | No | 7 | No | No | |
Non-type template parameters with auto type | P0127R2 | No | 7 | No | No | |
Guaranteed copy elision | P0135R1 | No | 7 | No | No | |
Stricter expression evaluation order | P0145R3 | No | 7 | No | No | |
Requirement to ignore unknown attributes | P0283R2 | No | Yes | No | Yes | |
constexpr if-statements | P0292R2 | No | 7 | No | 3.9 | |
Inline variables | P0386R2 | No | 7 | No | 3.9 | |
Structured bindings | P0217R3 | No | 7 | No | No | |
Separate variable and condition for if and switch | P0305R1 | No | 7 | No | 3.9 | |
Matching template template parameters to compatible arguments | P0522R0 | No | 7 | No | No | |
Removing deprecated dynamic exception specifications | P0003R5 | No | 7 | No | No | |
Pack expansions in using-declarations | P0195R2 | No | No | No | No |