C++ and C++'0x Support in Clang

Last updated: $Date$

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 from the C++'0x draft). However, the implementation of Clang C++ is still somewhat immature, with remaining bugs that may cause compiler crashes, erroneous errors and warnings, or miscompiled code. The LLVM bug tracker contains a Clang C++ component that tracks known Clang C++ bugs.

Projects Building with Clang

Clang is now capable of compiling large C++ projects, and the following table describes various projects that we have attempted to compile with Clang++.

Project Status Last Tested Tracking Bug
Clang and LLVM Successful self-hosting achieved Continually
CMake Compiles, passes regression tests (debug build) February 9, 2010
Boost Compiles and passes regression tests on Darwin/X86-64. May 20, 2010 PR6023
Qt Partially compiles; miscompilation of uic prevents complete compilation, qmake works, some small examples also. February 9, 2010 PR5881

C++0x Implementation status

Clang's development effort is focused primarily on fixing bugs in the current ISO C++ standard (1998/2003). This section tracks the status of various C++0x features.

Implementation Status by Feature

The following table is used to help track our implementation progress toward implementing the complete C++'0x standard. We use a simple, somewhat arbitrary color-coding scheme to describe the relative completeness of features:

Not started/not evaluated Not Applicable Broken Some examples work Many examples work Nearly everything works Complete Complete (with tests for each paragraph)
N/A

A feature is "complete" when the appropriate Clang component (Parse, AST, Sema, CodeGen) implements the behavior described in all of the paragraphs in the relevant C++'0x draft standard. The major components are:

Parse
Clang is able to parse the grammar of this feature (or the grammar described by this section), but does not necessarily do anything with the parsed result. Use Clang's -fsyntax-only option to parse C++ programs.
AST
Clang builds an abstract syntax tree (AST) for the feature, but does not necessarily perform any type-checking. Use Clang's -ast-print option to print the resulting ASTs.
Sema
Clang parses and type-checks this feature and provides a well-formed AST annotated with types. Use Clang's -fsyntax-only to type-check code.
CodeGen
Clang parses, type-checks, and generates code for this feature, allowing one to compile and execute programs.

Updates to this table are welcome! Tests for the various features are also welcome!

C++0x Features
Feature Parse AST Sema CodeGen Notes
Explicit conversion operators (N2437) No name mangling; ASTs don't contain calls to conversion operators
Static assertions (N1720) N/A
Deleted functions (N2346) N/A
Rvalue references (N2118 + N2831)
nullptr (N2431)
Right angle brackets (N1757) N/A N/A N/A
Decltype (N2343) N/A
noexcept (N3050) N/A
Inline namespaces (N2535) N/A