expected icon indicating copy to clipboard operation
expected copied to clipboard

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

Open petetheladd opened this issue 3 years ago • 3 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
}

petetheladd avatar Apr 26 '21 15:04 petetheladd

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?

shdnx avatar Jul 13 '21 13:07 shdnx

Reproduced with GCC 7.5

ManuelMeraz avatar Jul 19 '21 15:07 ManuelMeraz

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.

petetheladd avatar Jul 19 '21 17:07 petetheladd