boostorg / boostorg/safe_numerics

boost::safe_numerics::safe<...> is convertible to std::string?

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

Description

Is it intentional that the following code does not produce an error when compiled?

```
#include
#include
#include

static_assert(std::is_convertible_v, std::string>);
```

It seems wrong, but maybe there is a reason for it?

I'm trying to track down a (to me) relatively obscure problem elsewhere, and I think this may be at least related to, if not the cause of the problems I'm seeing. I checked the two most recent versions of clang and gcc and got the same behavior in all cases.

Contributor guide

No contributing guide indexed for this repository

Research direction

The reproducer includes boost/safe_numerics/safe_integer.hpp and checks std::is_convertible_v, std::string>; start by compiling that static assertion with the reported compilers. Trace the safe conversion path and compare the observed result with the intended API behavior; done means the conversion behavior has a documented resolution and a regression check.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.