-
Notifications
You must be signed in to change notification settings - Fork 265
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
When creating a variable using >> or & on an integral type, somehow the deduced type is some kind of pointer rather than an integer.
https://cpp2.godbolt.org/z/sf4Y7MxMz
bar: (foo: uint32_t) -> uint32_t = {
x := foo >> 16;
y := foo & 0xFFFF;
return (x+1) ^ (y-1);
}
gives
example.cpp2(4,22): error: - - pointer arithmetic is illegal - use std::span or gsl::span instead
==> program violates bounds safety guarantee - see previous errors
If I explicitly say that y is a uint32_t, everything is fine, but why does cppfront think that it's a pointer?
(I've seen the same issue with x, but it doesn't reproduce in this example.)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working