no suitable constructor exists to convert from "int" to "std::expected<int, std::string>"
but compiles fine
#11140
Labels
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
Using
std::expected
produces errorsSteps to reproduce:
main.cpp
with the following code:1
with the messageno suitable constructor exists to convert from "int" to "std::expected<int, std::string>"C/C++(415)
Expected behavior:
No error message. Compiling with
g++ main.cpp -std=c++23
works with an output of1
as expected.Configuration and Logs
c_cpp_properties.json
C/C++: Log Diagnostics
Additional context
I also found another user who had the same issue and posted a question on stack overflow about it. He suggested that changing the compiler to an older one helped but the issue still persists for me even if I do that. My version of
gcc
isgcc version 13.1.1 20230614 (Red Hat 13.1.1-4) (GCC)
The text was updated successfully, but these errors were encountered: