-
Notifications
You must be signed in to change notification settings - Fork 17
Description
It is not actually true that 'a * b; ' is illegal if both are types. It is actually legal to define, e.g., a structure member as the same name as an existing typedef name. See, e.g., C99 6.7.7 example 3:
EXAMPLE 3 The following obscure constructions
typedef signed int t;
typedef int plain;
struct tag {
unsigned t:4;
const t:5;
plain r:5;
};
declare a typedef name t with type signed int,atypedef name plain with type int, and a structure with three bit-field members, one named t that contains values in the range [0, 15], ...
As far as I can see. nearly all redeclarations in a different namespace or inner scope are allowed. The only exception I see is in 6.9.1 paragraph 6: "An identifier declared as a typedef name shall not be redeclared as a parameter."
Unfortunately, it seems breaking that last rule is not uncommon. So maybe if we could allow that to be a warning, it would be very helpful.
Thanks for cast!
Kevin