-std=
command-line option.
For information about the status of C++ defect reports, please see this page.
For information about the status of the library implementation, please see the Implementation Status section of the Libstdc++ manual.
C++26 Support in GCCGCC has experimental support for the next revision of the C++ standard, which is expected to be published in 2026.
C++26 features are available since GCC 14. To enable C++26 support, add the command-line parameter -std=c++2c
to your g++
command line. Or, to enable GNU extensions in addition to C++26 features, add -std=gnu++2c
.
Important: Because the ISO C++26 standard is still evolving, GCC's support is experimental. No attempt will be made to maintain backward compatibility with implementations of C++26 features that do not reflect the final standard.
C++26 Language Features Language Feature Proposal Available in GCC? SD-6 Feature Test Remove undefined behavior from lexing P2621R2 (DR) Yes Making non-encodable string literals ill-formed P1854R4 (DR) 14 Unevaluated strings P2361R6 14 Add @, $, and ` to the basic character set P2558R2 15 constexpr cast fromvoid*
P2738R1 14 __cpp_constexpr >= 202306L On the ignorability of standard attributes P2552R3 (DR) 15 Static storage for braced initializers P2752R3 (DR) 14 User-generated static_assert
messages P2741R3 14 __cpp_static_assert >= 202306L Placeholder variables with no name P2169R4 14 __cpp_placeholder_variables >= 202306L Pack indexing P2662R3 15 __cpp_pack_indexing >= 202311L Removing deprecated arithmetic conversion on enumerations P2864R2 (DR) 14 Template parameter initialization P2308R1 (DR) Yes Disallow binding a returned reference to a temporary P2748R5 14 Attributes for structured bindings P0609R3 15 __cpp_structured_bindings >= 202403L Erroneous behavior for uninitialized reads P2795R5 No = delete("reason");
P2573R2 15 __cpp_deleted_function >= 202403L Variadic friends P2893R3 15 __cpp_variadic_friend >= 202403L Clarifying rules for brace elision in aggregate initialization P3106R1 (DR) Yes Disallow module declarations to be macros P3034R1 (DR) 15 Trivial infinite loops are not undefined behavior P2809R3 (DR) 14 constexpr
placement new P2747R2 15 __cpp_constexpr >= 202406L Structured binding declaration as a condition P0963R3 15 Ordering of constraints involving fold expressions P2963R3 No Deleting a pointer to an incomplete type should be ill-formed P3144R2 15 Structured bindings can introduce a pack P1061R10 16 __cpp_structured_bindings >= 202411L constexpr structured bindings and references to constexpr variables P2686R4 16 (no references to constexpr vars) constexpr exceptions P3068R5 16 __cpp_constexpr_exceptions >= 202411L Consistent grammar for sequences P3340R0 Yes Oxford variadic comma P3176R0 15 Deprecating the notion of trivial types P3247R2 15 Removing deprecated array comparisons P2865R5 15 Trivial unions P3074R7 No __cpp_trivial_union >= 202502L Partial program correctness P1494R5 No Contracts P2900R14 No __cpp_contracts >= 202502L Defang and deprecate memory_order::consume
P3475R2 No Concept and variable-template template-parameters P2841R7 No __cpp_template_parameters >= 202502L Trivial Relocatability P2786R13 16 __cpp_trivially_relocatable >= 202502L #embed
P1967R14 15 __cpp_pp_embed >= 202502L Allow attaching main to the global module P3618R0 (DR) 16 Reflection P2996R13 No __cpp_impl_reflection >= 202506L P3394R4 P3293R3 P3096R12 define_static_
{string
,object
,array
} P3491R3 No Expansion statements P1306R5 16 __cpp_expansion_statements >= 202506L constexpr virtual inheritance P3533R2 16 __cpp_constexpr_virtual_inheritance >= 202506L Preprocessing is never undefined P2843R3 16 C++23 Support in GCC
GCC has experimental support for the latest revision of the C++ standard, which was finalized in 2023 and published in 2024.
C++23 features are available since GCC 11. To enable C++23 support, add the command-line parameter -std=c++23
to your g++
command line. Or, to enable GNU extensions in addition to C++23 features, add -std=gnu++23
.
Important: Because the ISO C++23 standard is very recent, GCC's support is experimental.
C++23 Language Features Language Feature Proposal Available in GCC? SD-6 Feature Test Literal Suffix for (signed) size_t P0330R8 11 __cpp_size_t_suffix >= 202006L Make () more optional for lambdas P1102R2 11 DR: Declarations and where to find them P1787R6 Noif consteval
P1938R3 12 __cpp_if_consteval >= 202106L C++ Identifier Syntax using Unicode Standard Annex 31 P1949R7 12 Allow Duplicate Attributes P2156R1 11 Narrowing contextual conversions to bool P1401R5 9 Trimming whitespaces before line splicing P2223R2 Yes Mixed string literal concatenation P2201R1 Yes Make declaration order layout mandated P1847R4 Yes Removing Garbage Collection Support P2186R2 12 Simpler implicit move P2266R3 13 __cpp_implicit_move >= 202207L Deducing this P0847R7 14 __cpp_explicit_this_parameter >= 202110L CWG2586 Change scope of lambda trailing-return-type P2036R3 16 P2579R0 Multidimensional subscript operator P2128R6 12 __cpp_multidimensional_subscript >= 202110L CWG2507 13 Non-literal variables (and labels and gotos) in constexpr functions P2242R3 12 __cpp_constexpr >= 202110L Character encoding of diagnostic text P2246R1 No Character sets and encodings P2314R4 10 Consistent character literal encoding P2316R2 Yes Add support for preprocessing directives elifdef and elifndef P2334R1 12 Extend init-statement to allow alias-declaration P2360R0 12 auto(x): decay-copy in the language P0849R8 12 Labels at the end of compound statements P2324R1 13 CWG 2397: auto specifier for pointers and references to arrays CWG2397 12 CWG 2481: Cv-qualification of temporary to which a reference is bound CWG2481 Yes Attributes on lambda-expressions P2173R1 9 A type trait to detect reference binding to temporary P2255R2 13 The Equality Operator You Are Looking For P2468R2 13 De-deprecating volatile compound operations P2327R1 13 Support for #warning
P2437R1 Yes (extension)
operator()
P1169R4 13 __cpp_static_call_operator >= 202207L Extended floating-point types and standard names P1467R9 13 __STDCPP_FLOAT16_T__
char8_t
Compatibility and Portability Fix P2513R3 13 __cpp_char8_t >= 202207L Relax requirements on wchar_t
to match existing practices P2460R2 Yes Explicit lifetime management P2590R2 No static operator[]
P2589R1 13 __cpp_multidimensional_subscript >= 202211L Permitting static constexpr
variables in constexpr
functions P2647R1 13 __cpp_constexpr >= 202211L DR: consteval
needs to propagate up P2564R3 14 __cpp_consteval >= 202211L DR: Meaningful exports P2615R1 15 Wording for P2644R1 Fix for Range-based for Loop P2718R0 15 __cpp_range_based_for >= 202211L C++20 Support in GCC
GCC has experimental support for the previous revision of the C++ standard, which was published in 2020. The status of C++20 library features is described in the library documentation.
C++20 features are available since GCC 8. To enable C++20 support, add the command-line parameter -std=c++20
(use -std=c++2a
in GCC 9 and earlier) to your g++
command line. Or, to enable GNU extensions in addition to C++20 features, add -std=gnu++20
.
Important: Because the ISO C++20 standard is recent, GCC's support is experimental.
C++20 Language FeaturesThe following table lists new language features that have been accepted into the C++20 working draft. 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 Default member initializers for bit-fields P0683R1 8 Fixing const-qualified pointers to members P0704R1 8 Allow lambda capture[=, this]
P0409R2 8 __VA_OPT__
for preprocessor comma elision P0306R4
#__VA_OPT__
support)
const
mismatch with defaulted copy constructor P0641R2 9 Less eager instantiation of constexpr
functions P0859R0 5.2 (mostly)
operator<=>
) P0515R3 10 __cpp_impl_three_way_comparison >= 201711 P0905R1 P1120R0 P1185R2 P1186R3 11 P1630R1 10 P1946R0 P1959R0 P2002R1 10.2 P2085R0 Access checking on specializations P0692R1 Yes Default constructible and assignable stateless lambdas P0624R2 9 Lambdas in unevaluated contexts P0315R4 9 Language support for empty objects P0840R2 9 Relaxing the range-for loop customization point finding rules P0962R1 8 Allow structured bindings to accessible members P0969R0 8 Relaxing the structured bindings customization point finding rules P0961R1 8 Down with typename! P0634R3 9 Allow pack expansion in lambda init-capture P0780R2 9 __cpp_init_captures >= 201803 P2095R0 10 Proposed wording for likely and unlikely attributes P0479R5 9 Deprecate implicit capture of this via [=] P0806R2 9 Class Types in Non-Type Template Parameters P0732R2 9 __cpp_nontype_template_parameter_class >= 201806 Inconsistencies with non-type template parameters P1907R1 10 (no floating point, union, or subobject template args)
consteval virtual
)
__cpp_
macros)
__has_cpp_attribute
) Modules P1103R3 11 (requires -fmodules-ts
)
extern "C/C++"
,
__cpp_modules >= 201810L
T*
to bool
should be considered narrowing P1957R2 10 (C++20 mode only), 11 (all modes) Stronger Unicode requirements P1041R4
a[b,c]
P1161R3 10 Deprecating some uses of volatile
P1152R4 10 [[nodiscard("with reason")]]
P1301R4 10 using enum
P1099R5 11 Class template argument deduction for aggregates P1816R0 10 __cpp_deduction_guides >= 201907L P2082R1 11 Class template argument deduction for alias templates P1814R0 10 Permit conversions to arrays of unknown bound P0388R4 10 constinit
P1143R2 10 __cpp_constinit >= 201907 Layout-compatibility and Pointer-interconvertibility Traits P0466R5 12 (in library) DR: Checking for abstract class types P0929R2 11 DR: More implicit moves (merge P0527R1 and P1155R3) P1825R0 11 (C++20 mode) DR: Pseudo-destructors end object lifetimes P0593R6 11 C++17 Support in GCC
GCC has almost full support for the 2017 revision of the C++ standard. The status of C++17 library features is described in the library documentation.
C++17 mode is the default since GCC 11; it can be explicitly selected with the -std=c++17
command-line flag, or -std=gnu++17
to enable GNU extensions as well. Some C++17 features are available since GCC 5, but support was experimental and the ABI of C++17 features was not stable until GCC 9.
The following table lists new language 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 "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 Removing trigraphs N4086 5u8
character literals N4267 6 __cpp_unicode_characters >= 201411 Folding expressions N4295 6 __cpp_fold_expressions >= 201411 Attributes for namespaces and enumerators N4266 4.9 (namespaces)
static_assert
N3928 6 __cpp_static_assert >= 201411 New Rules for auto deduction from braced-init-list N3922 5 Allow typename in a template template parameter N4051 5 [[fallthrough]]
attribute P0188R1 7 __has_cpp_attribute(fallthrough) [[nodiscard]]
attribute P0189R1 4.8 ([[gnu::warn_unused_result]]
)
[[maybe_unused]]
attribute P0212R1 4.8 ([[gnu::unused]]
)
constexpr
lambda P0170R1 7 __cpp_constexpr >= 201603 Unary Folds and Empty Parameter Packs P0036R0 6 __cpp_fold_expressions >= 201603 Generalizing the Range-Based For Loop P0184R0 6 __cpp_range_based_for >= 201603 Lambda capture of *this
by Value P0018R3 7 __cpp_capture_star_this >= 201603 Construction Rules for enum class
variables P0138R2 7 Hexadecimal floating literals for C++ P0245R1 3.0 __cpp_hex_float >= 201603 Dynamic memory allocation for over-aligned data P0035R4 7 __cpp_aligned_new >= 201606 Guaranteed copy elision P0135R1 7 __cpp_guaranteed_copy_elision >= 201606 Refining Expression Evaluation Order for Idiomatic C++ P0145R3 7 constexpr
if P0292R2 7 __cpp_if_constexpr >= 201606 Selection statements with initializer P0305R1 7 Template argument deduction for class templates P0091R3
register
Keyword P0001R1 7 Remove Deprecated operator++(bool)
P0002R1 7 Make exception specifications be part of the type system P0012R1 7 __cpp_noexcept_function_type >= 201510 __has_include
for C++17 P0061R1 5 Rewording inheriting constructors (core issue 1941 et al) P0136R1 7 __cpp_inheriting_constructors >= 201511 Inline variables P0386R2 7 __cpp_inline_variables >= 201606 DR 150, Matching of template template arguments P0522R0 7 __cpp_template_template_args >= 201611 Removing dynamic exception specifications P0003R5 7 Pack expansions in using-declarations P0195R2 7 __cpp_variadic_using >= 201611 A byte
type definition P0298R0 7 DR 727, In-class explicit instantiations CWG727 No Technical Specifications
GCC also implements experimental support for some language Technical Specifications published by the C++ committee.
Important: Because these Technical Specifications are still evolving toward future inclusion in a C++ standard, GCC's support is experimental. No attempt will be made to maintain backward compatibility with implementations of features that do not reflect the final standard.
Technical Specification Document Available in GCC? Compiler Option SD-6 Feature Test Concepts N4377 6 -fconcepts __cpp_concepts >= 201507 Transactional Memory N4514 6 (no atomic_cancel) -fgnu-tm __cpp_transactional_memory >= 201505 Coroutines N4649 10 -fcoroutines __cpp_impl_coroutine >= 201902L Modules N4720 11 -fmodules-ts __cpp_modules >= 201810L C++14 Support in GCCGCC has full support for the 2014 C++ standard.
This mode is the default in GCC 6.1 up until GCC 10 (inclusive); it can be explicitly selected with the -std=c++14
command-line flag, or -std=gnu++14
to enable GNU extensions as well.
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.
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)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? SD-6 Feature Test Runtime-sized arrays with automatic storage durationGCC 4.8.1 was the first feature-complete implementation of the 2011 C++ standard, previously known as C++0x.
This mode can be selected with the -std=c++11
command-line flag, or -std=gnu++11
to enable GNU extensions as well.
For information about C++11 support in a specific version of GCC, please see:
export
feature which was later removed from the language.
This mode is the default in GCC versions prior to 6.1; it can be explicitly selected with the -std=c++98
command-line flag, or -std=gnu++98
to enable GNU extensions as well.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4