std::sizeof is not considered constexpr
Open
dslx
- Dominant language
- C++
- Stars
- 1.9k
- Forks
- 283
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 135
Description
std::sizeof is not considered a compile time constant even though the value is known at compile time.
Repro:
```rust
import std;
fn foo(x: u32, z:u8) -> u8 {
x[0:std::sizeof(z)]
}
```
Error:
```
std_size_not_const.x:4:20-4:23
0002:
0003: fn foo(x: u32, z:u8) -> u8 {
0004: x[0:std::sizeof(z)]
~~~~~~~~~~~~~~~~~~~~~~~~~^-^ TypeInferenceError: Unable to resolve slice limit to a compile-time constant.
0005: }
```
Contributor guide
Assessment
This issue has not been assessed yet.