C Support in Clang

Clang implements the following published and upcoming ISO C standards:

Language Standard Flag Available in Clang?
C89 -std=c89 Yes
C99 -std=c99 Almost certainly
C11 -std=c11 Probably
C17 -std=c17 Maybe?
C2x -std=c2x Partial

The implementation status for C99, C11, and C17 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. We implement the resolution for defect reports, but we do not currently track our DR status (help with tracking DR status is appreciated).

The LLVM bug tracker uses the "c", "c11", "c18", and "c2x" labels to track known bugs with Clang's language conformance.

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.

C99 implementation status

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

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 Feature C99 Proposal Available in Clang?
restricted character set support via digraphs and <iso646.h> Unknown Unknown
more precise aliasing rules via effective type Unknown Unknown
restricted pointers N448 Unknown
variable length arrays N683 Yes
flexible array members Unknown Yes
static and type qualifiers in parameter array declarators Unknown Yes
more precise aliasing rules via effective type Unknown Unknown
complex and imaginary support in <complex.h>
N620 Unknown
N638 Unknown
N657 Unknown
N694 Unknown
N809 Unknown
type-generic math macros in <tgmath.h> N693 Yes
the long long int type N601 Yes
increase minimum translation limits N590 Unknown
additional floating-point characteristics in <float.h> Unknown Unknown
remove implicit int
N635 Yes
N692 Yes
N722 Yes
reliable integer division N617 Unknown
universal character names (\u and \U) Unknown Yes
extended identifiers N717 Unknown
hexadecimal floating-point constants N308 Yes
compound literals N716 Yes
designated initializers N494 Yes
// comments N644 Yes
extended integer types and library functions in <inttypes.h> and <stdint.h> Unknown Yes
remove implicit function declaration N636 Unknown
preprocessor arithmetic done in intmax_t/uintmax_t N736 Unknown
mixed declarations and code N740 Yes
new block scopes for selection and iteration statements Unknown Unknown
integer constant type rules N629 Unknown
integer promotion rules N725 Unknown
macros with a variable number of arguments N707 Yes
IEC 60559 support Unknown Unknown
trailing comma allowed in enum declaration Unknown Yes
inline functions N741 Yes
boolean type in <stdbool.h> N815 Yes
idempotent type qualifiers N505 Unknown
empty macro arguments N570 Unknown
new structure type compatibility (tag compatibility) N522 Unknown
additional predefined macro names Unknown Unknown
_Pragma preprocessing operator N634 Yes
standard pragmas
N631 Unknown
N696 Unknown
__func__ predefined identifier N611 Yes
va_copy macro N671 Yes
LIA compatibility annex N792 No
remove deprecation of aliased array parameters Unknown Unknown
conversion of array to pointer not limited to lvalues Unknown Unknown
relaxed constraints on aggregate and union initialization Unknown Unknown
relaxed restrictions on portable header names N772 Unknown
return without an expression not permitted in function that returns a value Unknown Yes

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 Feature C11 Proposal Available in Clang?
A finer-grained specification for sequencing N1252 Unknown
Clarification of expressions N1282 Unknown
Extending the lifetime of temporary objects (factored approach) N1285 Unknown
Requiring signed char to have no padding bits N1310 Unknown
Initializing static or external variables N1311 Unknown
Conversion between pointers and floating types N1316 Yes
Adding TR 19769 to the C Standard Library N1326 Clang 3.3
Static assertions N1330 Yes
Parallel memory sequencing model proposal N1349 Unknown
Analyzability (#1, #4 - conditionally normative) N1350 Unknown
FLT_EVAL_METHOD issues (first change only) N1353 Unknown
_Bool bit-fields N1356 Unknown
Technical corrigendum for C1X N1359 Unknown
Benign typedef redefinition N1360 Clang 3.1
Thread-local storage N1364 Clang 3.3
Constant expressions N1365 Unknown
Contractions and expression evaluation methods N1367 Unknown
FLT_EVAL_METHOD and return N1382 Unknown
Floating-point to int/_Bool conversions N1391 Unknown
Analyzability (along the lines) N1394 Unknown
Wide function returns (alternate proposal) N1396 Unknown
Alignment
N1397 Clang 3.2
N1447 Clang 3.2
Anonymous member-structures and unions (modulo "name lookup") N1406 Yes
Completeness of types N1439 Unknown
Generic macro facility N1441 Yes
Dependency ordering for C memory model N1444 Unknown
Subsetting the standard N1460 Unknown
Assumed types in F.9.2 N1468 Unknown
Supporting the 'noreturn' property in C1x N1478 Clang 3.3
Updates to C++ memory model based on formalization N1480 Unknown
Explicit initializers for atomics N1482 Unknown
Atomics proposal (minus ternary op) N1485 Yes
UTF-8 string literals N1488 Clang 3.3
Optimizing away infinite loops N1509 Yes
Conditional normative status for Annex G N1514 Unknown
Creation of complex value N1464 Unknown
Recommendations for extended identifier characters for C and C++ N1518 Unknown
Atomic C1x/C++0x compatibility refinements (1st part only) N1526 Yes
Atomic bitfields implementation defined N1530 Yes
Small fix for the effect of alignment on struct/union type compatibility N1532 Yes
Synthesis re _Atomic N1537 Unknown
Clarification for wide evaluation N1531 Unknown

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).

C2x implementation status

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

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

List of features and minimum Clang version with support
Language Feature C2x Proposal Available in Clang?
Evaluation formats N2186 Unknown
Clarifying the restrict Keyword v2 N2660 Unknown
Harmonizing static_assert with C++ N2665 Clang 9
nodiscard attribute N2667 Clang 9
maybe_unused attribute N2670 Clang 9
TS 18661 Integration
N2314 Unknown
N2341 Unknown
N2401 Unknown
N2359 Unknown
N2546 Unknown
Preprocessor line numbers unspecified N2322 Yes
deprecated attribute N2334 Clang 9
Attributes
N2335 Clang 9
N2554 Clang 9
Defining new types in offsetof N2350 Yes
fallthrough attribute N2408 Clang 9
Two's complement sign representation N2412 Clang 14
Adding the u8 character prefix N2418 No
Remove support for function definitions with identifier lists N2432 No
*_IS_IEC_60559 feature test macros N2379 Unknown
Floating-point negation and conversion N2416 Unknown
Annex F.8 update for implementation extensions and rounding N2384 Unknown
_Bool definitions for true and false N2393 No
[[nodiscard("should have a reason")]] N2448 Clang 10
Allowing unnamed parameters in function definitions N2480 Clang 11
Free positioning of labels inside compound statements N2508 No
Clarification request for C17 example of undefined behavior N2517 No
Querying attribute support N2553 Clang 9
Binary literals N2549 Clang 9
Allow duplicate attributes N2557 Clang 13
Character encoding of diagnostic text N2563 Yes
What we think we reserve N2572 Partial
Decimal floating-point triples N2580 Unknown
Remove mixed wide string literal concatenation N2594 Clang 9
Update to IEC 60559:2020 N2600 Unknown
Compatibility of Pointers to Arrays with Qualifiers N2607 Partial
String functions for freestanding implementations N2524 No
Digit separators N2626 Clang 13
Missing DEC_EVAL_METHOD N2640 Unknown
Missing +(x) in table N2641 Unknown
Add support for preprocessing directives elifdef and elifndef N2645 Clang 13