You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On MSVC 19.21 with C++17, CTAD fails with tl::optional whereas it works with std::optional:
tl::optional o = 3; // Cannot deduce T
std::optional o = 3; // Deduces T to be int
I think this is just a case of missing std::optional's deduction guide, since adding that in fixes it, but strangely Clang and GCC don't seem to need the guide and deduce T to be int anyway. I don't know enough about CTAD to know exactly what's going on here, so sorry if this isn't actually a bug in tl::optional and is instead a compiler bug.
The text was updated successfully, but these errors were encountered:
Thanks for the report! Ah, it's because MSVC doesn't set __cplusplus properly unless you pass /Zc:__cplusplus, and the deduction guide is behind an ifdef. Will see if there's a more foolproof way of detecting C++17 mode for MSVC without that switch.
Hi, first of all thanks for this library!
On MSVC 19.21 with C++17, CTAD fails with
tl::optional
whereas it works withstd::optional
:I think this is just a case of missing
std::optional
's deduction guide, since adding that in fixes it, but strangely Clang and GCC don't seem to need the guide and deduceT
to beint
anyway. I don't know enough about CTAD to know exactly what's going on here, so sorry if this isn't actually a bug intl::optional
and is instead a compiler bug.The text was updated successfully, but these errors were encountered: