How to get list of supported standards in Clang?

Check this file: llvm.git/tools/clang/include/clang/Frontend/LangStandards.def
online version from github
The standard supported by compiler is keep changing, you could check this file and try it yourself.

// C++ modes
LANGSTANDARD(cxx98, "c++98",
             "ISO C++ 1998 with amendments",
             LineComment | CPlusPlus | Digraphs)
LANGSTANDARD(cxx03, "c++03",
             "ISO C++ 1998 with amendments",
             LineComment | CPlusPlus | Digraphs)
LANGSTANDARD(gnucxx98, "gnu++98",
             "ISO C++ 1998 with amendments and GNU extensions",
             LineComment | CPlusPlus | Digraphs | GNUMode)

LANGSTANDARD(cxx0x, "c++0x",
             "ISO C++ 2011 with amendments",
             LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
LANGSTANDARD(cxx11, "c++11",
             "ISO C++ 2011 with amendments",
             LineComment | CPlusPlus | CPlusPlus11 | Digraphs)
LANGSTANDARD(gnucxx0x, "gnu++0x",
             "ISO C++ 2011 with amendments and GNU extensions",
             LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)
LANGSTANDARD(gnucxx11, "gnu++11",
             "ISO C++ 2011 with amendments and GNU extensions",
             LineComment | CPlusPlus | CPlusPlus11 | Digraphs | GNUMode)

https://github.com/llvm-mirror/clang/commit/6b15b6d3c1f8274162d5881b05d79aeddd5d6aad

In case user did not provide valid standard name for -std option, available values (with short description) will be reported.


Just specify any BS standard and clang will print those acceptable like so:

c:\LLVM\bin>clang++.exe -std=blabla main.cpp
error: invalid value 'blabla' in '-std=blabla'
note: use 'c++98' or 'c++03' for 'ISO C++ 1998 with amendments' standard
note: use 'gnu++98' or 'gnu++03' for 'ISO C++ 1998 with amendments and GNU extensions' standard
note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
note: use 'c++17' for 'ISO C++ 2017 with amendments' standard
note: use 'gnu++17' for 'ISO C++ 2017 with amendments and GNU extensions' standard
note: use 'c++2a' for 'Working draft for ISO C++ 2020' standard
note: use 'gnu++2a' for 'Working draft for ISO C++ 2020 with GNU extensions' standard

;-)

Tags:

Clang