Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AbigailBuccaneer opened this issue Oct 9, 2018 · 3 comments

Comments

@AbigailBuccaneer
Copy link

§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
Copy link
Owner

mpark commented Oct 9, 2018

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
Copy link
Owner

mpark commented Oct 9, 2018

Fixed in 9fd2f4f

@mpark mpark closed this as completed Oct 9, 2018
@jfbastien
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants