mpark/wg21

P1260r0 (Pattern Matching) paper has accidental switch fallthrough bug in example code

AbigailBuccaneer opened this issue · 3 comments

§3.1 reads:

Before

switch (x) {
  case 0: std::cout << "got zero";
  case 1: std::cout << "got one";
  default: std::cout << "don't care";
}

After

inspect (x) {
  0: std::cout << "got zero";
  1: std::cout << "got one";
  _: std::cout << "don't care";
}

The 'Before' side is missing break statements after each case's existing statement.

mpark commented

Haha, thanks for the report! Yes, @jfbastien actually pointed this out on Twitter yesterday https://twitter.com/jfbastien/status/1049515840541007872 I haven't fixed it since it's already been submitted for the mailing. It's a little embarrassing but really, it's kind of beautiful.

mpark commented

Fixed in 9fd2f4f

The break was implicit, in that the code was broken 🤡