boostorg / boostorg/safe_numerics

Recursive Alias Declaration under MSVC

Open
#135 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
222
Forks
46
PR merge metrics
No merged PRs in 30d

Description

To my understanding `safe<>` should work in any template as integer safety is orthogonal.

I am unable to use `safe` in `std::span` in MSVC:

```c++
#include
#include
#include

using Int = boost::safe_numerics::safe;

auto foo_safe(std::span numbers) -> int {
return int {numbers[0]};
}

int main() {
const auto numbers = std::vector {
Int {1}, Int {2}, Int {3}
};

return foo_safe(numbers);
}

```

This leads to a **recursive alias declaration** error:
```
error C2968:
'legal_overload > > > >,__int64>':
recursive alias declaration
```

[See on godbolt.](https://godbolt.org/z/831ThMsP1)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.