我希望能够在编译期间检测枚举重复值:
enum a{ A= 0, B =0 }; // A and B values are duplicate
我检查了GCC选项,没有成功。
典型的用例将是一些“遗留代码”,如:
enum b { A = /* some bitwise operators evaluated at compile time */,
B = /* some bitwise operators evaluated at compile time */, ... }