Repeating declaration specifiers

I hope that this has not been asked before, but does Clang allow
multiple declaration specifiers on purpose? See the following line of
code:

const const const const volatile const int const const volatile gggg = 8;

Clang produces no diagnostics on this. GCC says:

testt.cpp:8: error: duplicate ‘const’
testt.cpp:8: error: duplicate ‘volatile’

While I would say that I hope GCC is actually correct, I am not sure.
Any language lawyers who can help?

Thanks,
Marcin

Not a language lawyer, but I think GCC is correct.

[dcl.type] says "const or volatile can be combined with any other
type-specifier. However, redundant cv-qualifiers are prohibited except
when introduced through the use of typedefs or template type
arguments, in which case the redundant cv-qualifiers are ignored."

There seems to be a bug filed for this already:
http://llvm.org/bugs/show_bug.cgi?id=8264

Thanks,
Hans

Any language lawyers who can help?

Forbidden in C++, allowed in C.

Any language lawyers who can help?

Forbidden in C++, allowed in C.

Turns out Clang does catch this, but only with the -pedantic flag.

Maybe it should be an error by default?

Any language lawyers who can help?

Forbidden in C++, allowed in C.

Turns out Clang does catch this, but only with the -pedantic flag.

Maybe it should be an error by default?

I would say that -pedantic is pretty reasonable, since the code can be compiled without any issues. Maybe it could be a warning by default.

I have no idea how widely does this appear in real code bases.

Any language lawyers who can help?

Forbidden in C++, allowed in C.

Turns out Clang does catch this, but only with the -pedantic flag.

Maybe it should be an error by default?

I would say that -pedantic is pretty reasonable, since the code can be
compiled without any issues. Maybe it could be a warning by default.

I have no idea how widely does this appear in real code bases.

Can't be too common if GCC gives an error for it.