chromium / subspace

A concept-centered standard library for C++20, enabling safer and more reliable products and a more modern feel for C++ code.; Also home of Subdoc the code-documentation generator.
https://suslib.cc
Apache License 2.0
89 stars 15 forks source link

Can we prevent rvalue construction of numerics from primitives #271

Closed danakj closed 1 year ago

danakj commented 1 year ago

To prevent usize a = prim + prim which could overflow in the primitives?

danakj commented 1 year ago

Nope: https://godbolt.org/z/4xTGao56z

Both i = a + a and j = 2 bind to the rvalue constructor.