Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: NCCE code fix

...

Code Block
bgColor#FFcccc
langcpp
#include <exception>
#include <iostream>
 
struct S : std::exception {
  const char *what() const noexcept override {
    return "My custom exception";
  }
};
 
void f() {
  try {
    S s;
    throw S()&s;
  } catch (std::exception* e) {
    std::cout << e.what->what() << std::endl;
  }
}

Compliant Solution

...