C++ and C++'11 Support in Clang
Last updated: $Date: 2011-10-14 16:35:48 -0700 (Fri, 14 Oct 2011) $
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 provides support for a number of features included in the new ISO C++ Standard, ISO/IEC 14882:2011. The following table describes which C++11 features have been implemented in Clang and in which Clang versions they became available.
You can use Clang in C++11 mode either with libc++ or with gcc's libstdc++. libstdc++-4.4 requires a patch to work with clang; other versions have not been tested.
| Language Feature | C++0x 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 | No |
| 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 |
| New wording for C++0x lambdas | N2927 | No |
| Declared type of an expression | N2343 | Clang 2.9 |
| 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 | No |
| Generalized attributes | N2761 | No |
| Generalized constant expressions | N2235 | No |
| Alignment support | N2341 | Clang 3.0 |
| Delegating constructors | N1986 | Clang 3.0 |
| Inheriting constructors | N2540 | No |
| 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 name literals | N2170 | No |
| User-defined literals | N2765 | No |
| Standard Layout Types | N2342 | Clang 3.0 |
| Defaulted and deleted functions | N2346 | Clang 2.9 |
| Extended friend declarations | N1791 | Clang 2.9 |
Extending sizeof |
N2253 | No |
| Inline namespaces | N2535 | Clang 2.9 |
| Unrestricted unions | N2544 | No |
| 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 | No |
| Allowing move constructors to throw [noexcept] | N3050 | Clang 3.0 |
| Defining move special member functions | N3053 | Clang 3.0 |
| Concurrency | ||
| Sequence points | N2239 | No |
| Atomic operations | N2427 | No |
| Strong Compare and Exchange | N2748 | No |
| Bidirectional Fences | N2752 | No |
| Memory model | N2429 | No |
| Data-dependency ordering: atomics and memory model | N2664 | No |
| Propagating exceptions | N2179 | Clang 2.9 |
| Abandoning a process and at_quick_exit | N2440 | No |
| Allow atomics use in signal handlers | N2547 | No |
| Thread-local storage | N2659 | No |
| Dynamic initialization and destruction with concurrency | N2660 | No |
| C99 Features in C++0x | ||
__func__ predefined identifier |
N2340 | Clang 2.9 |
| C99 preprocessor | N1653 | Clang 2.9 |
long long |
N1811 | Clang 2.9 |
| Extended integral types | N1988 | No |