C++ Support in Clang

Clang implements the following published and upcoming ISO C++ standards:

Language StandardFlagAvailable in Clang?
C++2c-std=c++2cPartial
C++23-std=c++23Partial
C++20-std=c++20Partial
C++17-std=c++17Clang 5
C++14-std=c++14Clang 3.4
C++11-std=c++11Clang 3.3
C++98 / C++03-std=c++98Yes (other than export)

The Clang community is continually striving to improve C++ standards compliance between releases by submitting and tracking C++ Defect Reports and implementing resolutions as they become available.

Experimental work is also under way to implement C++ Technical Specifications that will help drive the future of the C++ programming language.

The LLVM bug tracker uses the "c++" label, as well as mode-specific labels such as "c++11", "c++14", and so on, to track known bugs with Clang's language conformance.

C++2c implementation status

Clang has support for some of the features of the C++ standard following C++23, informally referred to as C++26.

You can use Clang in C++2c mode with the -std=c++2c option.

List of features and minimum Clang version with support
Language FeatureC++26 ProposalAvailable in Clang?
Remove undefined behavior from lexingP2621R2 (DR)Clang 3.3
Making non-encodable string literals ill-formedP1854R4 (DR)Clang 14
Unevaluated stringsP2361R6Clang 18
Add @, $, and ` to the basic character setP2558R2Yes
constexpr cast from void*P2738R1Clang 17
On the ignorability of standard attributesP2552R3 (DR)Yes
Static storage for braced initializersP2752R3 (DR)No
User-generated static_assert messagesP2741R3Clang 17
Placeholder variables with no nameP2169R4Clang 18
Template parameter initializationP2308R1 (DR)Clang 18
Pack IndexingP2662R3Clang 19
Remove Deprecated Arithmetic Conversion on EnumerationsP2864R2Clang 18
Disallow Binding a Returned Glvalue to a TemporaryP2748R5Clang 19
Clarifying rules for brace elision in aggregate initializationP3106R1 (DR)Clang 17
Attributes for Structured BindingsP0609R3Clang 19
Module Declarations Shouldn’t be MacrosP3034R1 (DR)No
Trivial infinite loops are not Undefined BehaviorP2809R3 (DR)Clang 19
Erroneous behaviour for uninitialized readsP2795R5No
= delete("should have a reason");P2573R2Clang 19
Variadic friendsP2893R3Clang 20
constexpr placement newP2747R2Clang 20
Deleting a Pointer to an Incomplete Type Should be Ill-formedP3144R2Clang 19
Ordering of constraints involving fold expressionsP2963R3Clang 19
Structured binding declaration as a conditionP0963R3Clang 21
constexpr structured bindingsP2686R5No
Allowing exception throwing in constant-evaluationP3068R6No
Remove Deprecated Array Comparisons from C++26P2865R6Clang 20
Structured Bindings can introduce a PackP1061R10Clang 21
The Oxford variadic commaP3176R1Clang 20
Trivial unionsP3074R7No
Partial program correctnessP1494R5No
ContractsP2900R14No
Defang and deprecate memory_order::consumeP3475R2No
Concept and variable-template template-parametersP2841R7No
Trivial RelocatabilityP2786R13No
#embed
P1967R14No

C++23 implementation status

Clang has support for some of the features of the ISO C++ 2023 standard.

You can use Clang in C++23 mode with the -std=c++23 option.

List of features and minimum Clang version with support
Language FeatureC++23 ProposalAvailable in Clang?
Literal suffix uz, z for size_t, ssize_tP0330R8Clang 13
Make () in lambdas optional in all casesP1102R2Clang 13
Simpler implicit moveP2266R3Clang 13
if constevalP1938R3Clang 14
Allow duplicate attributesP2156R1 (DR)Clang 13
Narrowing contextual conversions to boolP1401R5Clang 14
Trimming whitespaces before line splicingP2223R2Yes
Make declaration order layout mandatedP1874R4Yes
C++ identifier syntax using UAX 31P1949R7 (DR)Clang 14
Mixed string literal concatenationP2201R1Yes
Deducing thisP0847R7Clang 18
P2797R0Clang 19
Change scope of lambda trailing-return-typeP2036R3 (DR)Clang 17
P2579R0 (DR)
Multidimensional subscript operatorP2128R6Clang 15
Non-literal variables (and labels and gotos) in constexpr functionsP2242R3Clang 15
Character encoding of diagnostic textP2246R1Yes
Character sets and encodingsP2314R4Yes
Consistent character literal encodingP2316R2Yes
Add support for preprocessing directives elifdef and elifndefP2334R1Clang 13
Extend init-statement to allow alias-declarationP2360R0Clang 14
auto(x): decay-copy in the languageP0849R8Clang 15
Attributes on Lambda-ExpressionsP2173R1Clang 13
constexpr for <cmath> and <cstdlib>P0533R9No
Type trait to determine if a reference binds to a temporaryP2255R2Clang 19
The Equality Operator You Are Looking ForP2468R2 (DR)Clang 16
De-deprecating volatile compound operationsP2327R1 (DR)Clang 15
Support for #warningP2437R1Yes
Remove non-encodable wide character literals and multicharacter wide character literalsP2362R3Clang 14
Labels at the end of compound statementsP2324R2Clang 16
Delimited escape sequencesP2290R3Clang 15
Named universal character escapesP2071R2Clang 15
Relaxing some constexpr restrictionsP2448R2Clang 19
Using unknown pointers and references in constant expressionsP2280R4 (DR)Clang 20
static operator()P1169R4Clang 16
Extended floating-point types and standard namesP1467R9No
Class template argument deduction from inherited constructorsP2582R1No
Portable assumptionsP1774R8Clang 19
Support for UTF-8 as a portable source file encodingP2295R6Clang 15
char8_t Compatibility and Portability FixP2513R3 (DR)Clang 16
Relax requirements on wchar_t to match existing practicesP2460R2 (DR)Yes
Explicit lifetime managementP2590R2No
static operator[]P2589R1Clang 16
Permitting static constexpr variables in constexpr functionsP2647R1Clang 16
consteval needs to propagate upP2564R3 (DR)Clang 17
Lifetime extension in range-based for loopsP2718R0Clang 20
Referencing The Unicode StandardP2736R2Yes

C++20 implementation status

Clang has support for some of the features of the ISO C++ 2020 standard.

You can use Clang in C++20 mode with the -std=c++20 option (use -std=c++2a in Clang 9 and earlier).

List of features and minimum Clang version with support
Language FeatureC++20 ProposalAvailable in Clang?
Default member initializers for bit-fieldsP0683R1Clang 6
const&-qualified pointers to membersP0704R1Clang 6
Allow lambda-capture[=, this]P0409R2Clang 6
__VA_OPT__ for preprocessor comma elisionP0306R4Clang 6
P1042R1Clang 9
Designated initializersP0329R4Clang 10
template-parameter-list for generic lambdasP0428R2Clang 9
ConceptsP0734R0Clang 10
P0857R0Clang 16
P1084R2Clang 10
P1141R2
P0848R3Clang 19
P1616R1Clang 10
P1452R2
P1972R0Clang 10
P1980R0
P2103R0
P2493R0 (DR)
P2092R0Clang 16
P2113R0Clang 16
Range-based for statements with initializerP0614R1Clang 8
ADL and function templates that are not visibleP0846R0Clang 9
const mismatch with defaulted copy constructorP0641R2Clang 8
Consistent comparison (operator<=>)P0515R3Clang 10
P0905R1
P1120R0
P1185R2
P1186R3
P1630R1
P1946R0
P1959R0
P2002R1Clang 17
P2085R0Clang 14
Access checking on specializationsP0692R1Clang 14
Default constructible and assignable stateless lambdasP0624R2Clang 8
Lambdas in unevaluated contextsP0315R4Clang 17
[[no_unique_address]] attributeP0840R2Clang 9
[[likely]] and [[unlikely]] attributesP0479R5Clang 12
typename optional in more contextsP0634R3Clang 16
Pack expansion in lambda init-captureP0780R2Clang 9
Class types as non-type template parametersP0732R2Clang 12
Generalized non-type template parameters of scalar typeP1907R1
Clang 18 (Partial) Reference type template arguments referring to instantiation-dependent objects and subobjects (i.e. declared inside a template but neither type- nor value-dependent) aren't fully supported.
Destroying operator deleteP0722R3Clang 6
Relaxations of constexpr restrictionsP1064R0Clang 9
P1002R1Clang 8
P1327R1Clang 9
P1330R0
P1331R2Clang 10
P1668R1
P0784R7
Prohibit aggregates with user-declared constructorsP1008R1Clang 8
Feature test macrosP0941R2(see below)
explicit(bool)P0892R2Clang 9
Signed integers are two's complementP1236R1Clang 9
char8_tP0482R6Clang 7 (11)
Immediate functions (consteval)P1073R3Clang 17
P1937R2Clang 14
std::is_constant_evaluatedP0595R2Clang 9
Nested inline namespacesP1094R2Clang 8
Structured binding extensionsP1091R3Clang 16
P1381R1
Stronger Unicode requirementsP1041R4Yes
P1139R2
Parenthesized initialization of aggregatesP0960R3Clang 16
P1975R0
ModulesP1103R3Clang 15
P1766R1 (DR)Clang 11
P1811R0No
P1703R1Subsumed by P1857
P1874R1Clang 15
P1979R0No
P1779R3Clang 15
P1857R3No
P2115R0Partial
P1815R2Partial
P2615R1 (DR)No
P2788R0 (DR)No
CoroutinesP0912R5
Partial Fully supported on all targets except Windows, which still has some stability and ABI issues.
Deprecate a[b,c]P1161R3Clang 9
Deprecate some problematic uses of volatileP1152R4Clang 10
[[nodiscard("with reason")]]P1301R4Clang 9
using enumP1099R5Clang 13
Class template argument deduction for aggregatesP1816R0Clang 17
P2082R1
Class template argument deduction for alias templatesP1814R0
Clang 19 (Partial) This feature has been initially completed, but the feature macro __cpp_deduction_guides has not been updated.
Permit conversions to arrays of unknown boundP0388R4Clang 14
constinitP1143R2Clang 10
Pseudo-destructors end object lifetimesP0593R6 (DR)Clang 11
More implicit movesP1825R0 (DR)Clang 13

(11): Prior to Clang 8, this feature is not enabled by -std=c++20, but can be enabled with -fchar8_t.

C++17 implementation status

Clang 5 and later implement all the features of the ISO C++ 2017 standard.

By default, Clang 16 or later builds C++ code according to the C++17 standard. You can use Clang in C++17 mode with the -std=c++17 option (use -std=c++1z in Clang 4 and earlier).

List of features and minimum Clang version with support
Language FeatureC++17 ProposalAvailable in Clang?
static_assert with no messageN3928Clang 3.5
Disabling trigraph expansion by defaultN4086Clang 3.5
typename in a template template parameterN4051Clang 3.5
New auto rules for direct-list-initialization N3922Clang 3.8 (8)
Fold expressionsN4295Clang 3.6
P0036R0Clang 3.9
u8 character literalsN4267Clang 3.6
Nested namespace definitionN4230Clang 3.6
Attributes for namespaces and enumeratorsN4266Clang 3.6
Allow constant evaluation for all non-type template argumentsN4268Clang 3.6
Remove deprecated register storage classP0001R1Clang 3.8
Remove deprecated bool incrementP0002R1Clang 3.8
Make exception specifications part of the type systemP0012R1Clang 4
__has_include in preprocessor conditionalsP0061R1Yes
[[fallthrough]] attributeP0188R1Clang 3.9
[[nodiscard]] attributeP0189R1Clang 3.9
P1771R1 (DR)Clang 9
[[maybe_unused]] attributeP0212R1Clang 3.9
Aggregate initialization of classes with base classesP0017R1Clang 3.9
constexpr lambda expressionsP0170R1Clang 5
Differing begin and end types in range-based forP0184R0Clang 3.9
Lambda capture of *thisP0018R3Clang 3.9
Direct-list-initialization of enumsP0138R2Clang 3.9
Hexadecimal floating-point literalsP0245R1Yes
Using attribute namespaces without repetitionP0028R4Clang 3.9
Dynamic memory allocation for over-aligned dataP0035R4Clang 4
Template argument deduction for class templatesP0091R3Clang 5
P0512R0
P0620R0 (DR)Clang 7
P0702R1 (DR)Clang 6
Non-type template parameters with auto typeP0127R2Clang 4
Guaranteed copy elisionP0135R1Clang 4
Stricter expression evaluation orderP0145R3Clang 4 (9)
P0400R0
Requirement to ignore unknown attributesP0283R2Yes
constexprif-statementsP0292R2Clang 3.9
Inline variablesP0386R2Clang 3.9
Structured bindingsP0217R3Clang 4
P0961R1 (DR)Clang 8
P0969R0 (DR)Clang 8
Separate variable and condition for if and switchP0305R1Clang 3.9
Matching template template parameters to compatible argumentsP0522R0 (DR)Clang 19 (10)
Removing deprecated dynamic exception specificationsP0003R5Clang 4
Pack expansions in using-declarationsP0195R2Clang 4

(8): This is a backwards-incompatible change that is applied to all language versions that allow type deduction from auto (per the request of the C++ committee). In Clang 3.7, a warning is emitted for all cases that would change meaning.
(9): Under the MS ABI, function parameters are destroyed from left to right in the callee. As a result, function parameters in calls to operator<<, operator>>, operator->*, operator&&, operator||, and operator, functions using expression syntax are no longer guaranteed to be destroyed in reverse construction order in that ABI. This is not fully supported during constant expression evaluation until Clang 12.
(10): While this feature was initially implemented in Clang 4, it was not enabled by default prior to clang 19, but could be enabled with -frelaxed-template-template-args. In Clang 19, the flag was deprecated. In Clang 21, the flag was removed altogether.

C++14 implementation status

Clang 3.4 and later implement all of the ISO C++ 2014 standard.

You can use Clang in C++14 mode with the -std=c++14 option (use -std=c++1y in Clang 3.4 and earlier).

List of features and minimum Clang version with support
Language FeatureC++14 ProposalAvailable in Clang?
Tweak to certain C++ contextual conversionsN3323Clang 3.4
Binary literalsN3472Clang 2.9
decltype(auto)N3638Clang 3.3
Return type deduction for normal functionsClang 3.4
Initialized lambda capturesN3648Clang 3.4
Generic lambdasN3649Clang 3.4
Variable templatesN3651Clang 3.4
Relaxing requirements on constexpr functionsN3652Clang 3.4
Member initializers and aggregatesN3653Clang 3.3
Clarifying memory allocationN3664Clang 3.4
[[deprecated]] attributeN3760Clang 3.4
Single quotation mark as digit separatorN3781Clang 3.4
C++ Sized DeallocationN3778Clang 3.4 (7)

(7): The user must supply definitions of the sized deallocation functions, either by providing them explicitly or by using a C++ standard library that does. libstdc++ added these functions in version 5.0, and libc++ added them in version 3.7. The user can also use the -fno-sized-deallocation option to disable sized deallocation.

C++11 implementation status

Clang 3.3 and later implement all of the ISO C++ 2011 standard.

You can use Clang in C++11 mode with the -std=c++11 option. Clang's C++11 mode can be used with libc++ or with gcc's libstdc++.

List of features and minimum Clang version with support
Language FeatureC++11 ProposalAvailable in Clang?
Rvalue referencesN2118Clang 2.9
P1825R0 (DR)Clang 13
    Rvalue references for *thisN2439Clang 2.9
Initialization of class objects by rvaluesN1610Clang 2.9
Non-static data member initializersN2756Clang 3.0
Variadic templatesN2242Clang 2.9
    Extending variadic template template parametersN2555Clang 2.9
Initializer listsN2672Clang 3.1
P1009R2 (DR)Clang 9
P1957R2 (DR)Clang 11
Static assertionsN1720Clang 2.9
auto-typed variablesN1984Clang 2.9
    Multi-declarator autoN1737Clang 2.9
    Removal of auto as a storage-class specifierN2546Clang 2.9
    New function declarator syntaxN2541Clang 2.9
Lambda expressionsN2927Clang 3.1
P0588R1 (DR)No
Declared type of an expressionN2343Clang 2.9
    Incomplete return typesN3276Clang 3.1
Right angle bracketsN1757Clang 2.9
Default template arguments for function templatesDR226Clang 2.9
Solving the SFINAE problem for expressionsDR339Clang 2.9
Alias templatesN2258Clang 3.0
Extern templatesN1987Clang 2.9
Null pointer constantN2431Clang 3.0
Strongly-typed enumsN2347Clang 2.9
Forward declarations for enumsN2764
DR1206
Clang 3.1
Standardized attribute syntaxN2761Clang 3.3 (1)
Generalized constant expressionsN2235Clang 3.1
P0859R0 (DR)Clang 8
Alignment supportN2341Clang 3.3
Conditionally-support behaviorN1627Clang 2.9
Changing undefined behavior into diagnosable errorsN1727Clang 2.9
Delegating constructorsN1986Clang 3.0
Inheriting constructorsN2540Clang 3.3
P0136R1 (DR)Clang 3.9
Explicit conversion operatorsN2437Clang 3.0
New character typesN2249Clang 2.9
Unicode string literalsN2442Clang 3.0
Raw string literalsN2442Clang 3.0
Universal character names in literalsN2170Clang 3.1
User-defined literalsN2765Clang 3.1
Standard Layout TypesN2342Clang 3.0
Defaulted functionsN2346Clang 3.0
P1286R2 (DR)Clang 9
Deleted functionsN2346Clang 2.9
Extended friend declarationsN1791Clang 2.9
Extending sizeofN2253
DR850
Clang 3.1
Inline namespacesN2535Clang 2.9
Unrestricted unionsN2544Clang 3.1
Local and unnamed types as template argumentsN2657Clang 2.9
Range-based forN2930Clang 3.0
P0962R1 (DR)Clang 8
Explicit virtual overridesN2928
N3206
N3272
Clang 3.0
Minimal support for garbage collection and reachability-based leak detectionN2670N/A (2)
Allowing move constructors to throw [noexcept]N3050Clang 3.0
Defining move special member functionsN3053Clang 3.0
Concurrency
Sequence pointsN2239Clang 3.3
Atomic operationsN2427Clang 3.1
Strong Compare and ExchangeN2748Clang 3.1 (3)
Bidirectional FencesN2752Clang 3.1
Memory modelN2429Clang 3.2
Data-dependency ordering: atomics and memory modelN2664Clang 3.2 (4)
Propagating exceptionsN2179Clang 2.9
Allow atomics use in signal handlersN2547Clang 3.1
Thread-local storageN2659Clang 3.3 (5)
Dynamic initialization and destruction with concurrencyN2660Clang 2.9
C99 Features in C++11
__func__ predefined identifierN2340Clang 2.9
C99 preprocessorN1653Clang 2.9
long longN1811Clang 2.9
Extended integral typesN1988N/A (6)

(1): The [[carries_dependency]] attribute has no effect.
(2): No compiler changes are required for an implementation such as Clang that does not provide garbage collection.
(3): All compare-exchange operations are emitted as strong compare-exchanges.
(4): memory_order_consume is lowered to memory_order_acquire.
(5): thread_local support requires a C++ runtime library providing __cxa_thread_atexit, such as libc++abi 3.6 or later, or libsupc++ 4.8 or later.
(6): No compiler changes are required for an implementation such as Clang that does not provide any extended integer types. __int128 is not treated as an extended integer type, because changing intmax_t would be an ABI-incompatible change.

C++98 implementation status

Clang implements all of the ISO C++ 1998 standard (including the defects addressed in the ISO C++ 2003 standard) except for export (which was removed in C++11).

Defect reports

Clang generally aims to implement resolutions to Defect Reports (bug fixes against prior standards) retroactively, in all prior standard versions where the fix is meaningful. Significant Defect Report changes to language features after the publication of the relevant standard are marked (DR) in the above table.

Clang also has a test suite for conformance to resolutions for issues on the C++ core issues list, most of which are considered Defect Reports. Implementation status for C++ core issues based on that test suite is tracked on a separate page.

Technical specifications and standing documents

ISO C++ also publishes a number of documents describing additional language and library features that are not part of standard C++.

List of features and minimum Clang version with support
DocumentLatest draftCompiler flagAvailable in Clang?
SD-6: SG10 feature test recommendationsSD-6N/A Clang 3.4 (N3745)
Clang 3.6 (N4200)
Clang 4 (P0096R3)
Clang 5 (P0096R4)
Clang 7 (P0096R5)
Clang 9 (P1353R0)
Clang 10 (P1902R1)
[TS] ConceptsP0121R0Superseded by P0734R0
[TS] CoroutinesN4663-fcoroutines-ts
-stdlib=libc++
Clang 5
-std=c++20
-stdlib=libc++
Superseded by P0912R5
[TS] Library Fundamentals, Version 1 (invocation type traits)N4480N/ANo
[TS] Library Fundamentals, Version 2 (source_location)N4617N/AClang 9 (documentation)
[TS] ModulesN4720-fmodules-tsSuperseded by P1103R3
[DRAFT TS] ReflectionN4818No
[TS] Transactional MemoryN4514No
close