Following gives error as expected:
int* const const p = new int; // g++ error: duplicate cv-qualifier
But below doesn’t give any error, even though it’s equivalent to above one:
typedef int* const intp_const;
intp_const const p = new int; // ok !
// ^^^^^ duplicate ?
Why does compiler ignores the extra const ?
[Note: intp_const const is not same as const char* const, because *p = <value>; is possible.]
In 7.1.5 [dcl.type] (C++03), it is stated that redundant cv-qualifiers are allowed when introduced through a typedef: