|
|
|
|
|
by loeg
3622 days ago
|
|
It isn't type-safe in the sense you're used to in C++. But common pitfalls can be avoided if you don't destroy the type information by assigning through a vanilla integer. enum a { A };
enum b { B };
static enum a a = B;
$ clang -Wenum-conversion -Werror a.c b.c:4:19: error: implicit conversion from enumeration type 'enum b' to different enumeration type 'enum a' [-Werror,-Wenum-conversion]
static enum a a = B;
~ ^
1 error generated.
|
|