C++ 2017 ISO C++ 2017 In this implementation the -std=gnu++17 or -std=c++17 flag must be used to enable language and library features. See dialect options. The pre-defined symbol __cplusplus is used to check for the presence of the required flag. This section describes the C++17 and library TS support in the GCC 7 series. The following table lists new library features that have been accepted into the C++17 working draft. The "Proposal" column provides a link to the ISO C++ committee proposal that describes the feature, while the "Status" column indicates the first version of GCC that contains an implementation of this feature (if it has been implemented). The "SD-6 Feature Test" column shows the corresponding macro or header from SD-6: Feature-testing recommendations for C++. C++ 2017 Implementation Status Library Feature Proposal Status SD-6 Feature Test constexpr std::hardware_{constructive,destructive}_interference_size P0154R1 No __cpp_lib_hardware_interference_size >= 201603 Core Issue 1776: Replacement of class objects containing reference members P0137R1 7.1 __cpp_lib_launder >= 201606 Wording for std::uncaught_exceptions N4259 6.1 __cpp_lib_uncaught_exceptions >= 201411 Variant: a type-safe union for C++17 P0088R3 7.1 __has_include(<variant>), __cpp_lib_variant >= 201603 (since 7.3, see Note 1) Library Fundamentals V1 TS Components: optional P0220R1 7.1 __has_include(<optional>), __cpp_lib_optional >= 201603 (since 7.3, see Note 1) Library Fundamentals V1 TS Components: any P0220R1 7.1 __has_include(<any>), __cpp_lib_any >= 201603 (since 7.3, see Note 1) Library Fundamentals V1 TS Components: string_view P0220R1 7.1 __has_include(<string_view>), __cpp_lib_string_view >= 201603 (since 7.3, see Note 1) Library Fundamentals V1 TS Components: memory_resource P0220R1 No __has_include(<memory_resource>), __cpp_lib_memory_resource >= 201603 Library Fundamentals V1 TS Components: apply P0220R1 7.1 __cpp_lib_apply >= 201603 Library Fundamentals V1 TS Components: shared_ptr<T[]> P0220R1 7.1 __cpp_lib_shared_ptr_arrays >= 201603 Library Fundamentals V1 TS Components: Searchers P0220R1 7.1 __cpp_lib_boyer_moore_searcher >= 201603 Library Fundamentals V1 TS Components: Sampling P0220R1 7.1 __cpp_lib_sample >= 201603 Constant View: A proposal for a std::as_const helper function template P0007R1 7.1 __cpp_lib_as_const >= 201510 Improving pair and tuple N4387 6.1 N/A make_from_tuple: apply for construction P0209R2 7.1 __cpp_lib_make_from_tuple >= 201606 Removing auto_ptr, random_shuffle(), And Old <functional> Stuff N4190 No (kept for backwards compatibility) Deprecating Vestigial Library Parts in C++17 P0174R2 No Making std::owner_less more flexible P0074R0 7.1 __cpp_lib_transparent_operators >= 201510 std::addressof should be constexpr LWG2296 7.1 __cpp_lib_addressof_constexpr >= 201603 Safe conversions in unique_ptr<T[]> N4089 6 LWG 2228: Missing SFINAE rule in unique_ptr templated assignment N4366 6 Re-enabling shared_from_this P0033R1 7.1 __cpp_lib_enable_shared_from_this >= 201603 A proposal to add invoke function template N4169 6.1 __cpp_lib_invoke >= 201411 TriviallyCopyable reference_wrapper N4277 5.1 Adopt not_fn from Library Fundamentals 2 for C++17 P0005R4 7.1 __cpp_lib_not_fn >= 201603 Fixes for not_fn P0358R1 7.1 Fixing a design mistake in the searchers interface in Library Fundamentals P0253R1 7.1 Extending memory management tools P0040R3 7.1 shared_ptr::weak_type P0163R0 7.1 __cpp_lib_shared_ptr_weak_type >= 201606 Transformation Trait Alias void_t N3911 6.1 __cpp_lib_void_t >= 201411 Wording for bool_constant, revision 1 N4389 6.1 __cpp_lib_bool_constant >= 201505 Adopt Type Traits Variable Templates from Library Fundamentals TS for C++17 P0006R0 7.1 __cpp_lib_type_trait_variable_templates >= 201510 Logical Operator Type Traits P0013R1 6.1 __cpp_lib_logical_traits >= 201510 Adding [nothrow-]swappable traits P0185R1 7 (__is_swappable available since 6.1) __cpp_lib_is_swappable >= 201603 is_callable, the missing INVOKE related trait P0077R2 7.1 __cpp_lib_is_callable >= 201603 has_unique_object_representations P0258R2 7.1 __cpp_lib_has_unique_object_representations >= 201606 Polishing <chrono> P0092R1 7.1 __cpp_lib_chrono >= 201510 Adding more constexpr to <chrono> P0505R0 7.1 __cpp_lib_chrono >= 201611 (since 7.3, see Note 2) Constexpr for std::char_traits P0426R1 7.3 __cpp_lib_constexpr_char_traits >= 201611 Integrating std::string_view and std::string P0254R2 7.1 Give 'std::string' a non-const '.data()' member function P0272R1 7.1 Cleaning-up noexcept in the Library N4258 6.1 __cpp_lib_allocator_traits_is_always_equal >= 201411 Contiguous Iterators N4284 N/A Minimal incomplete type support for standard containers N4510 3.0 __cpp_lib_incomplete_container_elements >= 201505 (since 6.2, see Note 2) Emplace return type P0084R2 7.1 Improved insertion interface for unique-key maps N4279 6.1 __cpp_lib_map_try_emplace >= 201411, __cpp_lib_unordered_map_try_emplace >= 201411 Splicing Maps and Sets P0083R3 7.1 __cpp_lib_node_extract >= 201606 Non-member size() and more N4280 6.1 __cpp_lib_nonmember_container_access >= 201411 A Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range Access P0031R0 7.1 __cpp_lib_array_constexpr >= 201603 The Parallelism TS Should be Standardized P0024R2 No __has_include(<execution>) , __cpp_lib_execution >= 201603 , __cpp_lib_parallel_algorithm >= 201603 An algorithm to "clamp" a value between a pair of boundary values P0025R0 7.1 __cpp_lib_clamp >= 201603 Adopt Selected Library Fundamentals V2 Components for C++17 P0295R0 7.1 __cpp_lib_gcd_lcm >= 201606 Proposal to Introduce a 3-Argument Overload to std::hypot P0030R1 7.1 __cpp_lib_hypot >= 201603 Mathematical Special Functions for C++17 P0226R1 7.1 __cpp_lib_math_special_functions >= 201603 (see Note 3) Adopt the File System TS for C++17 P0218R1 No __has_include(<filesystem>) , __cpp_lib_filesystem >= 201603 Relative Paths for Filesystem P0219R1 No __cpp_lib_filesystem >= 201606 Adapting string_view by filesystem paths P0392R0 No __cpp_lib_filesystem >= 201606 Directory Entry Caching for Filesystem P0317R1 No __cpp_lib_filesystem >= 201703 constexpr atomic<T>::is_always_lock_free P0152R1 7.1 __cpp_lib_atomic_is_always_lock_free >= 201603 A proposal to add shared_mutex (untimed) (Revision 4) N4508 6.1 __cpp_lib_shared_mutex >= 201505 Variadic lock_guard (Rev. 5) P0156R2 7.1 __cpp_lib_scoped_lock >= 201703 A byte type definition P0298R3 7.1 __cpp_lib_byte >= 201603 (since 7.3, see Note 2) Elementary string conversions P0067R5 8 (only integral types supported) __has_include(<charconv>) __cpp_lib_to_chars >= 201611
Note 1: This feature is supported in GCC 7.1 and 7.2 but before GCC 7.3 the __cpp_lib macro is not defined, and compilation will fail if the header is included without using to enable C++17 support. Note 2: This feature is supported in older releases but the __cpp_lib macro is not defined to the right value (or not defined at all) until the version shown in parentheses. Note 3: The mathematical special functions are enabled in C++17 mode from GCC 7.1 onwards. For GCC 6.x or for C++11/C++14 define __STDCPP_WANT_MATH_SPEC_FUNCS__ to a non-zero value and test for __STDCPP_MATH_SPEC_FUNCS__ >= 201003L. C++ Technical Specifications Implementation Status Paper Title Status Comments N4076 A generalized callable negator Y Library Fundamentals 2 TS N4273 Uniform Container Erasure Y Library Fundamentals 2 TS N4061 Greatest Common Divisor and Least Common Multiple Y Library Fundamentals 2 TS N4066 Delimited iterators Y Library Fundamentals 2 TS N4282 The World's Dumbest Smart Pointer Y Library Fundamentals 2 TS N4388 Const-Propagating Wrapper Y Library Fundamentals 2 TS N4391 make_array, revision 4 Y Library Fundamentals 2 TS N4502 Support for the C++ Detection Idiom, V2 Y Library Fundamentals 2 TS N4519 Source-Code Information Capture Y Library Fundamentals 2 TS N4521 Merge Fundamentals V1 into V2 N Library Fundamentals 2 TS P0013R1 Logical Operator Type Traits (revision 1) Y Library Fundamentals 2 TS
Implementation Specific Behavior For behaviour which is also specified by previous standards, see C++ 1998/2003 Implementation Specific Behavior and C++ 2011 Implementation Specific Behavior. This section only documents behaviour which is new in the 2017 standard. 23.6.5 [optional.bad_optional_access] what() returns "bad optional access". 23.7.3 [variant.variant] Whether variant supports over-aligned types should be documented here. 23.7.10 [variant.bad.access] what() returns "Unexpected index". 23.12.5.2 [memory.resource.pool.options] The limits for maximum number of blocks and largest allocation size supported by pool_options should be documented here. 23.12.6.1 [memory.resource.monotonic.buffer.ctor] The default next_buffer_size and growth factor should be documented here. 23.15.4.3 [meta.unary.prop] The predicate condition for has_unique_object_representations is true for all scalar types except floating point types. 23.19.3 [execpol.type], 28.4.3 [algorithms.parallel.exec] There are no implementation-defined execution policies. 24.4.2 [string.view.template] basic_string_view<C, T>::iterator is C* and basic_string_view<C, T>::const_iterator is const C*. 28.4.3 [algorithms.parallel.exec] Threads of execution created by std::thread provide concurrent forward progress guarantees, so threads of execution implicitly created by the library will provide parallel forward progress guarantees. 29.4.1 [cfenv.syn] The effects of the <cfenv> functions depends on whether the FENV_ACCESS pragma is supported, and on the C library that provides the header. 29.6.9 [c.math.rand] Whether the rand function may introduce data races depends on the target C library that provides the function. 29.9.5 [sf.cmath] The effect of calling the mathematical special functions with large inputs should be documented here. 30.10.2.1 [fs.conform.9945] The behavior of the filesystem library implementation will depend on the target operating system. Some features will not be not supported on some targets. 30.10.5 [fs.filesystem.syn] The clock used for file times is std::chrono::system_clock. 30.10.7.1 [fs.path.generic] dot-dot in the root-directory refers to the root-directory itself.