TartanLlama / expected

C++11/14/17 std::expected with functional-style extensions

Home Page:https://tl.tartanllama.xyz

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tl::expected<void, error> core dumping in error destructor

petetheladd opened this issue · comments

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
}

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?

Reproduced with GCC 7.5