| Issue |
61575
|
| Summary |
std::exclusive_scan narrows to type of initial value
|
| Labels |
libc++
|
| Assignees |
|
| Reporter |
upsj
|
```
#include <vector>
#include <numeric>
#include <iostream>
#include <limits>
#include <cstdint>
int main() {
std::vector<std::int64_t> vec{1LL << 32, 0};
std::exclusive_scan(vec.begin(), vec.end(), vec.begin(), 0);
std::cout << vec[0] << '\n';
std::cout << vec[1] << '\n';
}
```
I would expect this to output 0 and 1LL<<32, but it outputs 0, 0, because T in std::exclusive_scan is deduced to `int`, which is the computational type that will be used in exclusive_scan. Not sure if this is a library or standard defect, but I think this is pretty bug-prone otherwise. Related to https://github.com/NVIDIA/thrust/issues/1896
https://godbolt.org/z/zMf5M9hGK
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs