Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
petetheladd opened this issue Apr 26, 2021 · 3 comments
Open

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

petetheladd opened this issue Apr 26, 2021 · 3 comments

Comments

@petetheladd
Copy link

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
}
@shdnx
Copy link

shdnx commented Jul 13, 2021

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?

@ManuelMeraz
Copy link

Reproduced with GCC 7.5

@petetheladd
Copy link
Author

petetheladd commented Jul 19, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants