Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Adding some concerns
Page properties
hiddentrue

I am not convinced this is entirely sensible as a rule. The biggest issue is that this is unenforceable in a general case for C++. Consider uses of typeid where you want to get the type from an overloaded operator return type. Eg)

Code Block
struct S {
  // Assume these have side effects
  int f(char);
  double f(double);
};
 
void f() {
  S s;
  (void)typeid(s.f(1.0));
}

This code is valid, and somewhat reasonable, but disallowed. There's no way to statically determine whether those side effects are being relied upon or not.

Some expressions involve operands that are unevaluated. According to the C++ Standard, [expr], paragraph 8 [ISO/IEC 14882-2014]:

...