C++1y/C++14 Support in GCC

GCC has support for the latest revision of the C++ standard, which was published in 2014.

C++14 features are available as part of "mainline" GCC in the trunk of GCC's repository and in GCC 4.8 and later. To enable C++14 support, add the command-line parameter -std=c++14 to your g++ command line. Or, to enable GNU extensions in addition to C++14 extensions, add -std=gnu++14.

Important: Because the final ISO C++14 standard was only recently published, GCC's support is experimental. No attempt will be made to maintain backward compatibility with implementations of C++14 features that do not reflect the final standard.

C++14 Language Features

The following table lists new language features that are part of the C++14 standard. The "Proposal" column provides a link to the ISO C++ committee proposal that describes the feature, while the "Available in GCC?" column indicates the first version of GCC that contains an implementation of this feature (if it has been implemented).

Language Feature Proposal Available in GCC? SD-6 Feature Test
Tweak to certain C++ contextual conversions N3323 4.9
Binary literals N3472 4.3 (GNU)
4.9 (N3472)
__cpp_binary_literals >= 201304
Return type deduction for normal functions N3638 4.8 (N3386)
4.9 (N3638)
__cpp_decltype_auto >= 201304
Generalized lambda capture (init-capture) N3648 4.5 (partial)
4.9 (N3648)
__cpp_init_captures >= 201304
Generic (polymorphic) lambda expressions N3649 4.9 __cpp_generic_lambdas >= 201304
Variable templates N3651 5 __cpp_variable_templates >= 201304
Relaxing requirements on constexpr functions N3652 5 __cpp_constexpr >= 201304
Member initializers and aggregates N3653 5 __cpp_aggregate_nsdmi >= 201304
Clarifying memory allocation N3664 N/A
Sized deallocation N3778 5 __cpp_sized_deallocation >= 201309
[[deprecated]] attribute N3760 4.9 (N3797) __has_cpp_attribute(deprecated) >= 201309
Single-quotation-mark as a digit separator N3781 4.9 (N3797) __cpp_digit_separator >= 201309

This feature was briefly part of the C++14 working paper, but was not part of the published standard; as a result, it has been removed from the compiler.

Language Feature Proposal Available in GCC?
Runtime-sized arrays with automatic storage duration
(Removed from the standard)
N3639 ?.? (GNU VLAs)
4.9 (N3639)
5 (GNU VLAs)
__cpp_runtime_arrays >= 198712

C++14 Library Features

The status of the library implementation can be tracked in this table.