C++11 compiler support shootout: Visual Studio, GCC, Clang, Intel


It’s been more than half a year since my last comparison of the C++11 support across different compilers. This time I’d like to see how different compilers stack up based on the documentation for the pre-release versions of these compilers.

The next release of GCC is 4.8 and the upcoming version of Clang is 3.3. If you use Visual Studio 2012, you can install an experimental CTP update released in November 2012 to get additional C++11 features.

I’ve also thrown in v.13.0 of Intel’s C++ compiler out of curiosity, although it isn’t pre-release and there were a few features I couldn’t find information about. I didn’t find any information about the upcoming version of this compiler.

Feature VS2012
g++ 4.8 Clang 3.3 Intel 13.0
auto Yes Yes Yes Yes
decltype Yes Yes Yes Yes
Rvalue references and move semantics Yes Yes Yes Yes
Lambda expressions Yes Yes Yes Yes
nullptr Yes Yes Yes Yes
static_assert Yes Yes Yes Yes
Range based for loop Yes Yes Yes Yes
Trailing return type in functions Yes Yes Yes Yes
extern templates Yes Yes Yes Yes
>> for nested templates Yes Yes Yes Yes
Local and unnamed types as template arguments Yes Yes Yes Yes
Variadic macros Yes Yes Yes Yes
Variadic templates Yes Yes Yes Yes
Default template arguments in function templates Yes Yes Yes Yes
final method keyword Yes Yes Yes No
override method keyword Yes Yes Yes No
Strongly typed enums Yes Yes Yes Partial
Forward declared enums Yes Yes Yes Partial
Initializer lists Yes Yes Yes Partial
explicit type conversion operators Yes Yes Yes No
Raw string literals Yes Yes Yes No
Forwarding constructors Yes Yes Yes No
Template aliases No Yes Yes Yes
Defaulted methods No Yes Yes Yes
Deleted methods No Yes Yes Yes
Generalized attributes No Yes Yes Yes
New built-in types Partial Yes Yes Partial
Alignment support Partial Yes Yes No
Inline namespaces No Yes Yes No
sizeof on non-static data members without an instance No Yes Yes No
Changed restrictions on union members No Yes Yes No
User defined literals No Yes Yes No
Encoding support in literals No Yes Yes No
Arbitrary expressions in template deduction contexts No Yes Yes Don’t know
Non-static data member initializers No Yes Yes Don’t know
noexcept No Yes Yes Partial
constexpr No Yes Yes Partial
C99 compatibility Partial Partial Partial Yes
Thread local storage Partial Yes No Partial
Inheriting constructors No Yes No No
Rvalue references for *this No No Yes No

It looks like GCC is overtaking Clang as the compiler with the best C++11 support. Visual Studio has added several significant C++11 features such as variadic templates, initializer lists and raw literals.

I can’t really comment on how complete and bug-free these implementations are at a more fine grained level (other than VS2012 – I detail a lot of the bugs in the initial VS2012 release in my book, C++11 Rocks).

It’s also useful to look at the state of library support. I’m not going to get very specific as there are lots of small changes across the standard library. I’m also going to omit Intel’s library from this comparison.

I can say that the major additions to the library are mostly provided by all three implementations (as shown in the table below), although with various caveats.

Microsoft’s library implementation lacks anything that requires unimplemented language features such as constexpr (as of the initial release of VS2012). The library hasn’t been updated to use the features in the November 2012 CTP of the compiler such as initializer lists or variadic templates.

GCC’s libstdc++ lags somewhat as it doesn’t support regular expressions and low-level concurrency features. It also doesn’t implement constexpr methods in a lot of cases. std::function doesn’t have support for custom allocators, as Gilad noted in the comments below.

Clang’s libc++ is 100% complete on Mac OS, however various parts of it don’t yet work on Windows and Linux.

Feature MSVC libstdc++ libc++
Concurrency: async/future/promise/packaged_task Yes Yes Yes
Concurrency: thread and related Yes Yes Yes
Concurrency: condition variables Yes Yes Yes
Concurrency: mutexes Yes Yes Yes
Concurrency: atomic types and operations Yes Yes Yes
Concurrency: relaxed memory ordering and fences Yes No Yes
Smart pointers Yes Yes Yes
Tuples Yes Yes Yes
std::bind Yes Yes Yes
std::function Yes Yes Yes
Regular expressions Yes No Yes
Type traits Yes Partial Yes
std::forward_list Yes Yes Yes
std::array Yes Yes Yes
Hash tables Yes Yes Yes
Random number generation Yes Yes Yes
Compile time rational numbers (ratio) Yes Yes Yes
Time utilities (chrono) Yes Yes Yes
Initializer lists Yes Yes Yes
Diagnostics (system_error) Yes Yes Yes
STL refinements and new algorithms Yes Yes Yes
General purpose (move, forward, declval etc.) Yes Yes Yes
Minimal support for garbage collection Yes No No

It’s good to see that the language and library support is steadily improving. Clang and GCC are getting close to having full C++11 support. Visual Studio is also improving C++11 support, and I’m pleased that C++ compiler updates are happening between major releases. The list of supported features in Intel’s compilers is growing longer as well.

Who knows, by next year all four compilers might support all the C++11 features!


Keen on mastering C++11/14? I’ve written a book about the C++11/14 features. You can get a VS2013, Clang or a GCC edition.


24 Responses to “C++11 compiler support shootout: Visual Studio, GCC, Clang, Intel”

  1. It’s unfair to include Visual Studio CTP in comparison as most of the c++11 features are buggy and don’t work

    • Tomas
    • Tomas, if you said that C++11 features *added in the CTP* are buggy, you would have had a point.

      But in any case, I wanted to compare the state of C++11 support in pre-release compilers. Such a comparison is never going to be exact, but it’s meant to give an idea of how far along things have come.

      I’m also sure that *all* compilers have at least a few bugs, so it wouldn’t be possible to do a comparison at all by your rules.

    • Complaints about “fairness” are silly fanboi thinking … professionals just want to know the state of things. And Alex notes the glaring logical flaw in your statement — bugs in “most of the c++11 features” must include bugs outside of CTP, which is not relevant to whether to include CTP.

      • Marcel Kincaid
      • Exactly, it’s such a strange way of thinking. A compiler comparison isn’t a competition and isn’t about “winning”.

        • Alex Korban
  2. Support for thread local storage as well as c-tor inheritance has been added to Clang recently, making it fully C++11 compliant ;-)

    • kralyk
    • Yes, and they’ve already started implementing C++1y features (only binary literals so far, but still). GCC 4.8 has also been released.

      Things are changing quite fast, which is good! I guess I’ll revise this post in a few months to see how things stack up then.

  3. gcc support of std::function is still partial
    they are missing the ability to use custom allocators:


    AFAIK this is required in c++11

    • Gilad
    • Thanks for the comment! It’s quite tricky to draw the line between bugs and partial support, as most compilers have bugs. I’ll make a note about allocators in the post though.

      • Alex Korban
  4. Clang has “Partial” support on thread local storage, using the __thread keyword, similar to how MSVC’s partial support is __declspec( thread )

    • Levi
    • Thanks for the comment.

      The Clang status page states that “thread_local support currently requires g++-4.8′s C++ runtime library.” I prefer to consider Clang together with libc++.

      I’ve also seen indications that it doesn’t work at all on Windows. I think it would be a stretch to call it partial support so far, but you do have a point of course. It’s hard to be precise with broad categories like Yes/No/Partial.

  5. Do we have any information as to the status of C++11 support in IBM’s XL C++ compiler, HP’s aC++ compiler and Oracle’s Solaris Studio compiler?

    • Leo Carreon
    • There’s probably some information online but I haven’t looked at these compilers.

  6. Is VS 2012 still using PJ Plauger’s awful stdc++ library?
    The company name is either Dinkumware or Whitesmiths, I can’t remember.

    If it is, that’s a major reason to stay the hell away from it.

    • Fred Sanford
    • They do, but what’s so awful about it? I believe it’s improved a lot over the years.

      • Alex Korban
  7. Is there a newer article comparing the latest compilers: Visual C++ 2013, etc.

    • HGH
    • Not at this point! However there aren’t a lot of changes at this point. VS2013 should be very similar to the VS2012 CTP I used for comparison here.

      GCC has full C++11 language support as of 4.8.1. Clang has full support too.

      As far as libraries go, GCC has added regex support to the as yet unreleased 4.9. There might be a few other library changes I’m not aware of.

  8. I’m afraid raw string literals are not supported in vs 2012. They first implemented them i 2013 version: http://msdn.microsoft.com/pl-pl/library/hh567368.aspx

    • Marol
    • If you’re talking about release versions then yes. However, they were also present in the Nov 2012 CTP.

      • Alex Korban