Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Clarified the wording for one of the NCCEs

...

In this noncompliant code example, the class member variable C is not explicitly initialized by a ctor-initializer in the default constructor. Despite the local variable o being default-initialized, the use of C within the call to S::f() results in the use evaluation of an object with indeterminate value, resulting in undefined behavior.

Code Block
bgColor#FFcccc
langcpp
class S {
  int C;
 
public:
  int f(int I) const { return I + C; }
};
 
void f() {
  S o;
  int i = o.f(10);
}

...