tl::expected<void, error> core dumping in error destructor
petetheladd opened this issue · comments
petetheladd commented
I was changing some validate functions that would throw an exception or else just return if the input data is valid to use tl::expected.
The below code doesn't work if tl::expected<void, error> is used and an error is returned from validate but does if I replace with tl::expected<int, error>
// returns error if problem otherwise just returns
tl::expected<void, error> validate(const data&);
...
void checkData(const data& data ) {
validate(data).or_else([](error&& error) { throw error; }; // cores in error destructor
}
Gábor Kozár commented
I don't seem to be able to reproduce this issue on Linux x86-64 with GCC 10.2.0. Have you figured out what the problem is?
Manuel Meraz commented
Reproduced with GCC 7.5
petetheladd commented
Sorry for taking this long but yes it was with GCC 7
Regards
Peter Muldoon
On Monday, July 19, 2021, 11:37:23 AM EDT, Manuel Meraz ***@***.***> wrote:
Reproduced with GCC 7.5
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.