C++98, C++11, and C++14 Support in Clang

Last updated: $Date$

C++98 implementation status

Clang currently implements all of the ISO C++ 1998 standard (including the defects addressed in the ISO C++ 2003 standard) except for export (which has been removed in C++11) and is considered a production-quality C++ compiler. The LLVM bug tracker contains a Clang C++ component that tracks known Clang C++ bugs.

C++11 implementation status

Clang implements all of the ISO C++ 2011 standard. The following table describes the Clang version in which each feature became available.

By default, Clang builds C++ code according to the C++98 standard, with many C++11 features accepted as extensions. 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++, but patches are needed to make libstdc++-4.4 work with Clang in C++11 mode. Patches are also needed to make libstdc++-4.6, and libstdc++-4.7 work with Clang releases prior to version 3.2 in C++11 mode. thread_local support currently requires g++-4.8's C++ runtime library.

Language Feature C++11 Proposal Available in Clang?
Rvalue references N2118 Clang 2.9
    Rvalue references for *this N2439 Clang 2.9
Initialization of class objects by rvalues N1610 Clang 2.9
Non-static data member initializers N2756 Clang 3.0
Variadic templates N2242 Clang 2.9
    Extending variadic template template parameters N2555 Clang 2.9
Initializer lists N2672 Clang 3.1
Static assertions N1720 Clang 2.9
auto-typed variables N1984 Clang 2.9
    Multi-declarator auto N1737 Clang 2.9
    Removal of auto as a storage-class specifier N2546 Clang 2.9
    New function declarator syntax N2541 Clang 2.9
Lambda expressions N2927 Clang 3.1
Declared type of an expression N2343 Clang 2.9
    Incomplete return types N3276 Clang 3.1
Right angle brackets N1757 Clang 2.9
Default template arguments for function templates DR226 Clang 2.9
Solving the SFINAE problem for expressions DR339 Clang 2.9
Alias templates N2258 Clang 3.0
Extern templates N1987 Clang 2.9
Null pointer constant N2431 Clang 3.0
Strongly-typed enums N2347 Clang 2.9
Forward declarations for enums N2764
DR1206
Clang 3.1
Generalized attributes N2761 Clang 3.3 (1)
Generalized constant expressions N2235 Clang 3.1
Alignment support N2341 Clang 3.3
Delegating constructors N1986 Clang 3.0
Inheriting constructors N2540 Clang 3.3
Explicit conversion operators N2437 Clang 3.0
New character types N2249 Clang 2.9
Unicode string literals N2442 Clang 3.0
Raw string literals N2442 Clang 3.0
Universal character names in literals N2170 Clang 3.1
User-defined literals N2765 Clang 3.1
Standard Layout Types N2342 Clang 3.0
Defaulted functions N2346 Clang 3.0
Deleted functions N2346 Clang 2.9
Extended friend declarations N1791 Clang 2.9
Extending sizeof N2253
DR850
Clang 3.1
Inline namespaces N2535 Clang 2.9
Unrestricted unions N2544 Clang 3.1
Local and unnamed types as template arguments N2657 Clang 2.9
Range-based for N2930 Clang 3.0
Explicit virtual overrides N2928
N3206
N3272
Clang 3.0
Minimal support for garbage collection and reachability-based leak detection N2670 N/A
Allowing move constructors to throw [noexcept] N3050 Clang 3.0
Defining move special member functions N3053 Clang 3.0
Concurrency
Sequence points N2239 Clang 3.3
Atomic operations N2427 Clang 3.1
Strong Compare and Exchange N2748 Clang 3.1 (2)
Bidirectional Fences N2752 Clang 3.1
Memory model N2429 Clang 3.2
Data-dependency ordering: atomics and memory model N2664 Clang 3.2 (3)
Propagating exceptions N2179 Clang 2.9
Abandoning a process and at_quick_exit N2440 N/A
Allow atomics use in signal handlers N2547 Clang 3.1
Thread-local storage N2659 Clang 3.3
Dynamic initialization and destruction with concurrency N2660 Clang 2.9
C99 Features in C++11
__func__ predefined identifier N2340 Clang 2.9
C99 preprocessor N1653 Clang 2.9
long long N1811 Clang 2.9
Extended integral types N1988 N/A (4)

(1): The [[carries_dependency]] attribute has no effect.
(2): All compare-exchange operations are emitted as strong compare-exchanges.
(3): memory_order_consume is lowered to memory_order_acquire.
(4): __int128 is not treated as an extended integer type, because changing intmax_t would be an ABI-incompatible change.

C++1y implementation status

Clang is introducing support for the upcoming C++ language standard, provisionally named C++1y. The following table describes which C++1y features have been implemented in Clang and in which Clang version they became available.

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

Language Feature C++1y Proposal Available in Clang?
Tweak to certain C++ contextual conversions N3323 No
Binary literals N3472 Yes
decltype(auto) N3638 Clang 3.3
Return type deduction for normal functions Partial
Runtime-sized arrays with automatic storage duration N3639 Partial
Initialized lambda captures N3648 No
Generic lambdas N3649 No [WIP]
Variable templates N3651 No
Relaxing requirements on constexpr functions N3652 Partial
Member initializers and aggregates N3653 Clang 3.3
Clarifying memory allocation N3664 Yes