-
Notifications
You must be signed in to change notification settings - Fork 259
[BUG] inout parameterized statement generates wrong Cpp1 #393
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
Comments
It's not wrong. I think you're expected to give it a valid initializer just as you would an equally declared parameter (via an argument). |
Reading #386 (comment), the issue seems to be that #386 (comment)'s examples don't really work:
I, too, expected a parametrized statement of a single parameter to subsume all of Cpp1's |
For this case, you might want to "pass (the initializer) by"
Though that hits:
|
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
I think this is the grammar of parameterized statement blocks:
Internally
But
@JohelEGP, Good point. It seems the design has changed a little bit. Local variables cannot be references (e.g. |
Reading 8d2f274#diff-43ba71198da8225f205041c699dba495883d7d416c0b58916bf226aae97bafaeR3196-R3198 made me realize that this actually works: https://godbolt.org/z/z7W1q5ohW.
So I think the answer is "use the |
If I understand your suggestion correctly, in this case |
You're right. I hadn't read that comment from that commit. So I get your point now. You mean the behaviour of |
Question: 8d2f274 mentions that Another Question: This one is probably for Herb, how does he plan to handle |
It's likely an error to give a coroutine or |
Thanks! Added |
Actually primarily by a simple rename... as a |
That's great, I was hoping for something along those lines and your simple idea is even better than something I had in mind. Edit: Regearding @JohelEGP's comment, your comment seems to highlight the use of |
@AbhinavK00 Sure: When you use |
The main problem with `volatile` isn't the semantics -- those are are deliberately underspecified, and appropriate for talking about "memory that's outside the C++ program that the compiler can't assume it knows anything about" which is an important low-level concept. The problems with `volatile` are that (a) it's wired into the language as a type qualifier which is undesirable and unnecessary, and (b) the current name is confusing and has baggage and so it should be named something that connotes what it's actually for (and I like "alien" rather than "foreign" because I think "alien" has a better and stronger connotation).
Ah ok, I was thinking only for functions and there it doesn't matter to caller so I couldn't see any use but it may make sense for block parameters which I currently have to wrap my head around. |
Allow `copy` statement/block parameter, closes hsutter#393 Allow `class` and `struct` and other reclaimed words as declared names, closes hsutter#394
The main problem with `volatile` isn't the semantics -- those are are deliberately underspecified, and appropriate for talking about "memory that's outside the C++ program that the compiler can't assume it knows anything about" which is an important low-level concept. The problems with `volatile` are that (a) it's wired into the language as a type qualifier which is undesirable and unnecessary, and (b) the current name is confusing and has baggage and so it should be named something that connotes what it's actually for (and I like "alien" rather than "foreign" because I think "alien" has a better and stronger connotation).
cppfront compiles to Cpp1 fine, but Cpp1 declares the
i
variable wrongly:The text was updated successfully, but these errors were encountered: