AST: scoped enums with and without type qualifier

Hello!
I wanted to see the AST of scoped enums. The file test.cc containt only enum definition, nothing else.

clang -Xclang -ast-dump -fsyntax-only test.cc

clang output an error, when i specified a type and no error without type specification. Is it normal?

With type qualifier an error

enum class Foo : int {
kOne,
kTwo
};

test.cc:1:6: warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]
enum class Foo : int {
^
test.cc:1:12: error: ISO C++ forbids forward references to ‘enum’ types
enum class Foo : int {
^
test.cc:1:16: error: expected unqualified-id
enum class Foo : int {
^
TranslationUnitDecl 0x238a3f0 <>

-TypedefDecl 0x238a928 <> implicit __int128_t ‘__int128’
-BuiltinType 0x238a640 '__int128' -**TypedefDecl** 0x238a988 <<invalid sloc>> <invalid sloc> implicit **__uint128_t** 'unsigned __int128' -BuiltinType 0x238a660 ‘unsigned __int128’
-TypedefDecl 0x238aa18 <> implicit __builtin_ms_va_list ‘char *’
-PointerType 0x238a9e0 'char *' -BuiltinType 0x238a480 ‘char’
-**TypedefDecl** 0x238ad38 <<invalid sloc>> <invalid sloc> implicit **__builtin_va_list** 'struct __va_list_tag [1]' -ConstantArrayType 0x238ace0 ‘struct __va_list_tag [1]’ 1
-RecordType 0x238ab00 'struct __va_list_tag' -CXXRecord 0x238aa68 ‘__va_list_tag’
1 warning and 2 errors generated.

Without type qualifier

enum class Foo {
kOne,
kTwo
};

You need to tell the compiler to use at least c++11 by adding -std=c++11.

hth…
don