-
Notifications
You must be signed in to change notification settings - Fork 265
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Providing a negative number as the start of a for-range produces broken cpp1 code: the - negative is parsed to apply to the resulting range object rather than the number itself. To make it work one must surround the value with parentheses to clarify possession.
To Reproduce
https://godbolt.org/z/bMafrYvEM
main: () -> int = {
// BROKEN - will not compile
// produces -cpp2::range(2,2) rather than cpp2::range(-2,2)
for -2 ..< 2 do (y) {
...
}
// WORKAROUND - produces cpp2::range((-2),2)
for (-2) ..< 2 do (z) {
...
}
// NB end value is parsed correctly
for (-5) ..< -2 do (x) {
...
}
}Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working