C Support in Clang

Clang implements the following published and upcoming ISO C standards:

Language StandardFlagAvailable in Clang?
C2y-std=c2yPartial
C23-std=c23Partial
C17-std=c17Partial
C11-std=c11Partial
C99-std=c99Clang 17
C89-std=c89Yes

The implementation status for C11 and C23 are currently under investigation. Any proposal whose status in Clang is currently unknown will be marked in magenta.

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.

The LLVM bug tracker uses the "c", "c99", "c11", "c17", "c23", and "c2y" labels to track known bugs with Clang's language conformance.

C2y implementation status

Clang has support for some of the features of the C standard following C23, informally referred to as C2y.

You can use Clang in C2y mode with the -std=c2y option (available in Clang 19 and later).

List of features and minimum Clang version with support
Language FeatureC2y ProposalAvailable in Clang?
Sequential hexdigitsN3192Yes
Generic selection expression with a type operandN3260Clang 17
Round-trip roundingN3232Yes
Accessing byte arraysN3254Yes
Slay some earthly demons IN3244
Partial Clang does not document the implementation-defined behavior for decay of an array with the register storage class specifier. Clang does not diagnose an extern inline function with no definition in the TU. Clang accepts and rejects redeclarations with/without an alignment specifier, depending on the order of the declarations.
Support ++ and -- on complex valuesN3259Yes
Usability of a byte-wise copy of va_listN3262Yes
alignof of an incomplete array typeN3273Clang 3.5
Remove imaginary typesN3274Yes
Floating-point exceptions for macro replacementsN3286Yes
Obsolete implicitly octal literals and add delimited escape sequencesN3353Clang 21
'if' declarations, v2N3356No
Allowing stricter alignment for atomic typesN3312Yes
Slay Some Earthly Demons IIIN3341Yes
Slay Some Earthly Demons IVN3342Yes
Slay Some Earthly Demons VIN3344Clang 20
Slay Some Earthly Demons VIIN3345Yes
Slay Some Earthly Demons VIIIN3346Yes
Introduce complex literals v. 2N3298Yes
Allow zero length operations on null pointersN3322Yes
How do you add one to something?N3323Yes
Give consistent wording for SNAN initialization v3N3364Yes
Case range expressions v3.1N3370Yes
_Countof operator
N3369Clang 21
N3469Clang 21
Named loops, v3N3355No
Slay Some Earthly Demons IXN3347Yes
stdarg.h wording... v3N3363Clang 5
Preprocessor integer expressions, v. 2N3505Yes
Initialization of anonymous structures and unionsN3451Yes
Slay Some Earthly Demons XN3409Clang 21
Slay Some Earthly Demons XIN3410No
Slay Some Earthly Demons XIIN3411Clang 21
Slay Some Earthly Demons XIIIN3478Yes
Slay Some Earthly Demons XIVN3418No
Slay Some Earthly Demons XVIN3481Yes
Slay Some Earthly Demons XVIIN3482Yes
Clarify the specification of the width macrosN3496Clang 20
Complex operatorsN3460Clang 12

C23 implementation status

Clang has support for some of the features of the C standard following C17, informally referred to as C23.

You can use Clang in C23 mode with the -std=c23 option (available in Clang 18 and later) or with the -std=c2x option (available in Clang 9 and later).

List of features and minimum Clang version with support
Language FeatureC23 ProposalAvailable in Clang?
Evaluation formatsN2186Unknown
Harmonizing static_assert with C++N2665Clang 9
nodiscard attributeN2267Clang 9
maybe_unused attributeN2270Clang 9
TS 18661 Integration
N2314Unknown
N2341No
N2359No
N2546No
N2640Yes
N2755No
N2931No
N2754No
Preprocessor line numbers unspecifiedN2322
Partial The line number associated with a macro invocation is not the line number of the first character of the macro name in the invocation. Additionally, Clang may not associate the line number of a pp-directive with the first # token. As these are recommended practices and not normative requirements, Clang's behavior is still conforming.
deprecated attributeN2334Clang 9
Attributes
N2335Clang 9
N2554Clang 9
Defining new types in offsetofN2350Yes
fallthrough attributeN2408Clang 9
Two's complement sign representationN2412Clang 14
Adding the u8 character prefixN2418Clang 15
Remove support for function definitions with identifier listsN2432Clang 15
Annex F.8 update for implementation extensions and roundingN2384Unknown
_Bool definitions for true and falseN2393Subsumed by N2935
[[nodiscard("should have a reason")]]N2448Clang 10
Allowing unnamed parameters in function definitionsN2480Clang 11
Free positioning of labels inside compound statementsN2508Clang 18
Querying attribute supportN2553Clang 9
Binary literalsN2549Clang 9
Allow duplicate attributesN2557Clang 13
Character encoding of diagnostic textN2563Yes
What we think we reserveN2572Partial
Remove mixed wide string literal concatenationN2594Clang 9
Update to IEC 60559:2020N2600Unknown
Compatibility of Pointers to Arrays with QualifiersN2607
Partial Much of the proposal is implemented, but Clang lacks pedantic diagnostics in C17 and earlier regarding use of incompatible pointer types as an extension. Further, Clang does not properly compute the correct result type for the ?: operator when the result type should be a qualified array type.
Unclear type relationship between a format specifier and its argumentN2562Clang 16
Digit separatorsN2626Clang 13
Missing +(x) in tableN2641Yes
Add support for preprocessing directives elifdef and elifndefN2645Clang 13
[[maybe_unused]] for labelsN2662Clang 16
Zeros compare equalN2670Yes
Negative valuesN2671Yes
5.2.4.2.2 cleanupN2672Yes
Towards Integer SafetyN2683Clang 18
Adding Fundamental Type for N-bit Integers
N2763Clang 15
N2775Clang 15
N2969Clang 15
N3035Clang 15
#warning directiveN2686Yes
Sterile charactersN2686Yes
Numerically equalN2716Yes
char16_t & char32_t string literals shall be UTF-16 & UTF-32N2728Yes
IEC 60559 bindingN2749Unknown
__has_include for CN2799Yes
Annex F overflow and underflowN2747Yes
Remove UB from Incomplete Types in Function ParametersN2770Yes
Variably-modified typesN2778Yes
Types do not have typesN2781Yes
5.2.4.2.2 cleanup (N2672 update)N2806Yes
Allow 16-bit ptrdiff_tN2808Yes
Proposal to update CFP freestanding requirementsN2823Unknown
Types and sizesN2838Yes
Clarifying integer termsN2837Yes
Clarification for max exponent macrosN2843Subsumed by N2882
Clarification about expression transformationsN2846Unknown
Contradiction about INFINITY macroN2848Clang 19
Require exact-width integer type interfacesN2872Yes
@, $, and ‘ in the source/execution character setN2701Yes
The noreturn attributeN2764Clang 15
*_HAS_SUBNORM==0 implies what?N2797Yes
Disambiguate the storage class of some compound literalsN2819Clang 21
Add annotations for unreachable control flow v2N2826Clang 17
Unicode Sequences More Than 21 Bits are a Constraint Violation r0N2828Clang 3.6
Identifier Syntax using Unicode Standard Annex 31N2836Clang 15
No function declarators without prototypesN2841Clang 15
Remove default argument promotions for _FloatN typesN2844No
Revised Suggestions of Change for Numerically Equal/EquivalentN2847Yes
5.2.4.2.2 Cleanup, Again Again (N2806 update)N2879Yes
char8_t: A type for UTF-8 characters and stringsN2653Clang 19
Clarification for max exponent macros-updateN2882Unknown
Consistent, Warningless, and Intuitive Initialization with {}
N2900Clang 17
N3011Clang 17
Not-so-magic: typeof
N2927Clang 16
N2930Clang 16
Revise spelling of keywords v7N2934Clang 17
Make false and true first-class language features v8N2935Clang 15
Properly define blocks as part of the grammar v3N2937Yes
Annex X (replacing Annex H) for IEC 60559 interchangeN2601No
Indeterminate Values and Trap RepresentationsN2861Yes
Remove ATOMIC_VAR_INIT v2N2886Clang 17
Require exact-width integer type interfaces v2N2888Yes
Wording Change for Variably-Modified TypesN2992Yes
Identifier syntax fixesN2939Clang 15
Remove trigraphs??!N2940Clang 18
Improved normal enumerationsN3029Clang 20
Relax requirements for va_startN2975Clang 16
Enhanced enumerationsN3030Clang 20
Freestanding C and IEC 60559 conformance scope reductionN2951Unknown
Unsequenced functionsN2956No
Comma ommission and deletion (__VA_OPT__)N3033Clang 12
Underspecified object definitionsN3006No
Type inference for object declarationsN3007Clang 18
constexpr for object definitionsN3018Clang 19
Introduce storage class specifiers for compound literalsN3038No
Identifier primary expressionsN3034Yes
Introduce the nullptr constantN3042Clang 17
Memory layout of unionsN2929Yes
Improved tag compatibilityN3037No
#embedN3017Clang 19

C17 implementation status

There are no major changes in this edition, only technical corrections and clarifications that are tracked by Defect Report.

You can use Clang in C17 mode with the -std=c17 or -std=c18 options (available in Clang 6 and later).

C11 implementation status

Clang implements a significant portion of the ISO 9899:2011 (C11) standard, but the status of individual proposals is still under investigation.

You can use Clang in C11 mode with the -std=c11 option (use -std=c1x in Clang 3.0 and earlier).

List of features and minimum Clang version with support
Language FeatureC11 ProposalAvailable in Clang?
A finer-grained specification for sequencingN1252Unknown
Clarification of expressionsN1282Yes
Extending the lifetime of temporary objects (factored approach)N1285Clang 21
Requiring signed char to have no padding bitsN1310Yes
Initializing static or external variablesN1311Yes
Conversion between pointers and floating typesN1316Yes
Adding TR 19769 to the C Standard LibraryN1326Clang 3.3
Static assertionsN1330Yes
Parallel memory sequencing model proposalN1349Unknown
_Bool bit-fieldsN1356Yes
Technical corrigendum for C1XN1359Yes
Benign typedef redefinitionN1360Clang 3.1
Thread-local storageN1364Clang 3.3
Constant expressionsN1365Clang 16
Contractions and expression evaluation methodsN1367Unknown
Floating-point to int/_Bool conversionsN1391Yes
Wide function returns (alternate proposal)N1396
Yes* Clang conforms to this paper on all targets except 32-bit x86 without SSE2. However, Clang does not claim conformance to Annex F on any target and does not intend to ever conform to Annex F on that specific target, so no changes are needed to conform to this paper.
Alignment
N1397Clang 3.2
N1447Clang 3.2
Anonymous member-structures and unions (modulo "name lookup")N1406Yes
Completeness of typesN1439Yes
Generic macro facilityN1441Yes
Dependency ordering for C memory modelN1444Unknown
Subsetting the standardN1460Yes
Assumed types in F.9.2N1468Unknown
Supporting the 'noreturn' property in C1xN1478Clang 3.3
Updates to C++ memory model based on formalizationN1480Unknown
Explicit initializers for atomicsN1482Clang 4
Atomics proposal (minus ternary op)N1485Yes
UTF-8 string literalsN1488Clang 3.3
Optimizing away infinite loopsN1509Yes
Conditional normative status for Annex GN1514Yes (1)
Creation of complex valueN1464Clang 12
Recommendations for extended identifier characters for C and C++N1518Clang 15
Atomic C1x/C++0x compatibility refinements (1st part only)N1526Yes
Atomic bitfields implementation definedN1530Yes
Small fix for the effect of alignment on struct/union type compatibilityN1532Yes
Clarification for wide evaluationN1531Unknown
(1): Clang does not implement Annex G, so our conditional support conforms by not defining the __STDC_IEC_559_COMPLEX__ macro.

C99 implementation status

Clang implements all of the ISO 9899:1999 (C99) standard.

Note, the list of C99 features comes from the C99 committee draft. Not all C99 documents are publicly available, so the documents referenced in this section may be inaccurate, unknown, or not linked.

You can use Clang in C99 mode with the -std=c99 option.

List of features and minimum Clang version with support
Language FeatureC99 ProposalAvailable in Clang?
restricted character set support via digraphs and <iso646.h>UnknownYes
more precise aliasing rules via effective typeUnknownYes
restricted pointersN448
Partial Clang's support for restrict is fully conforming but considered only partially implemented. Clang implements all of the constraints required for restrict support, but LLVM only supports restrict optimization semantics for restricted pointers used as function parameters; it does not fully support the semantics for restrict on local variables or data members.
variable length arraysN683Yes
flexible array membersUnknownYes
static and type qualifiers in parameter array declaratorsUnknownYes
complex and imaginary support in <complex.h>N693
Partial Clang supports _Complex type specifiers but does not support _Imaginary type specifiers. Support for _Imaginary is optional in C99 and Clang does not claim conformance to Annex G.

_Complex support requires an underlying support library such as compiler-rt to provide functions like __divsc3. Compiler-rt isn't linked in automatically in MSVC style environments.
type-generic math macros in <tgmath.h>N693Yes
the long long int typeN601Yes
increase minimum translation limitsN590Clang 3.2
additional floating-point characteristics in <float.h>UnknownClang 16
remove implicit int
N635Yes
N692Yes
N722Yes
reliable integer divisionN617Yes
universal character names (\u and \U)UnknownYes
extended identifiersN717Clang 17
hexadecimal floating-point constantsN308Yes
compound literalsN716Yes
designated initializersN494Yes
// commentsN644Yes
extended integer types and library functions in <inttypes.h> and <stdint.h>UnknownYes
remove implicit function declarationN636Yes
preprocessor arithmetic done in intmax_t/uintmax_tN736Yes
mixed declarations and codeN740Yes
new block scopes for selection and iteration statementsUnknownYes
integer constant type rulesN629Yes
integer promotion rulesN725Yes
macros with a variable number of argumentsN707Yes
IEC 60559 supportUnknown
Partial Clang supports much of the language requirements for Annex F, but full conformance is only possible to determine when considering the compiler's language support, the C runtime library's math library support, and the target system's floating-point environment support. Clang does not currently raise an "invalid" floating-point exception on certain conversions, does not raise floating-point exceptions for arithmetic constant expressions, and other corner cases. Note, Clang does not define __STDC_IEC_559__ because the compiler does not fully conform. However, some C standard library implementations ( glibc, musl will define the macro regardless of compiler support unless the compiler defines __GCC_IEC_559, which Clang does not currently define.
Additionally, Clang intentionally will not conform to Annex F on 32-bit x86 without SSE2 due to the behavior of floating-point operations in x87.
trailing comma allowed in enum declarationUnknownYes
inline functionsN741Yes
boolean type in <stdbool.h>N815Yes
idempotent type qualifiersN505Yes
empty macro argumentsN570Yes
additional predefined macro namesUnknownYes
_Pragma preprocessing operatorN634Yes
standard pragmas
N631Yes
N696Yes
__func__ predefined identifierN611Yes
va_copy macroN671Yes
remove deprecation of aliased array parametersUnknownYes
conversion of array to pointer not limited to lvaluesN835Yes
relaxed constraints on aggregate and union initializationN782Clang 3.4
relaxed restrictions on portable header namesN772Yes
return without an expression not permitted in function that returns a valueUnknownYes

C89 implementation status

Clang implements all of the ISO 9899:1990 (C89) standard.

You can use Clang in C89 mode with the -std=c89 or -std=c90 options.

close