Reputation: 86075
I am using Clang included in Xcode 4.6.2 (4H1003).
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Currently my compiler doesn't make a compile error for this code.
using AA = int const;
static AA const aa = 0;
Because I am not familiar with accurate C++11 specs, I can't know what is correct behavior.
const
keyword.const
on using
is not allowed.What is expected behavior by standard?
Upvotes: 1
Views: 294
Reputation: 131829
This was already allowed back with C++98 - cv-qualifiers can be introduced multiple times through typedef names and template parameters - they're simply collapsed. If this wasn't allowed, generic code would have a lot of problems. The same thing happens for references too.
§7.1.6.1 [dcl.type.cv] p1
:
There are two cv-qualifiers,
const
andvolatile
. [...]
Redundant cv-qualifications are ignored. [ Note: For example, these could be introduced by typedefs.—end note ]
Upvotes: 4