26-03-2024, 03:08 PM
Hi,
I find the amplification of rule 10.2.3 confusing.
In general I wonder what the difference to a simple "no implicit conversion from unscoped enumeration type without underlying type to numeric type" (plus the exception for static_cast in bullet point 3) is?
In particular, as example, for the following code
I wonder whether (1) should be compliant or not. At least it is not listed in the amplification, but seems like a problematic case anyway.
In turn, should (2) be non-compliant as operands to "arithmetic operator" are explicitly listed in the amplification, while I think this case is absolutely fine.
It would be great to get a clarification on what the rule intends.
I find the amplification of rule 10.2.3 confusing.
In general I wonder what the difference to a simple "no implicit conversion from unscoped enumeration type without underlying type to numeric type" (plus the exception for static_cast in bullet point 3) is?
In particular, as example, for the following code
Code:
enum E {E1, E2};
int f(int);
E operator+(E, E);
int main() {
E e = E1;
f(e); // Compliant? (1)
e = e + e; // Non-compliant (2)
}
In turn, should (2) be non-compliant as operands to "arithmetic operator" are explicitly listed in the amplification, while I think this case is absolutely fine.
It would be great to get a clarification on what the rule intends.