Skip to content

Recursive Alias Declaration under MSVC #135

@christianbrugger

Description

@christianbrugger

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

I am unable to use safe<int> in std::span in MSVC:

#include <span>
#include <vector>
#include <boost/safe_numerics/safe_integer.hpp>

using Int = boost::safe_numerics::safe<int>;

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

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

This leads to a recursive alias declaration error:

error C2968: 
'legal_overload<boost::safe_numerics::addition_operator,std::_Vector_const_iterator<std::_Vector_val
<std::_Simple_types<boost::safe_numerics::safe_base<int,-2147483648,2147483647,boost::
safe_numerics::native,boost::safe_numerics::exception_policy<
boost::safe_numerics::throw_exception,boost::safe_numerics::throw_exception,boost::
safe_numerics::throw_exception,boost::safe_numerics::ignore_exception> > > > >,__int64>': 
recursive alias declaration

See on godbolt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions