Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
10.2.3 Amplification
#1
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
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)
}
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.
Reply


Messages In This Thread
10.2.3 Amplification - by hahn - 26-03-2024, 03:08 PM
RE: 10.2.3 Amplification - by misra cpp - 12-04-2024, 02:20 PM
RE: 10.2.3 Amplification - by hahn - 06-05-2024, 08:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)