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

Regression with REQUIRE_THROWS_AS #817

Closed
joto opened this issue Feb 9, 2017 · 2 comments
Closed

Regression with REQUIRE_THROWS_AS #817

joto opened this issue Feb 9, 2017 · 2 comments

Comments

@joto
Copy link

joto commented Feb 9, 2017

Description

I used to be able to write code such as:

REQUIRE_THROWS_AS({
    statement1;
    statement2;
    ...
}, std::runtime_error);

This does not work any more (tested in version 1.7.1, it worked in 1.5.9, didn't test anything in between). Clang reports this as error: expected expression at the { and GCC as expected primary-expression before ‘{’ token.

The simpler

REQUIRE_THROWS_AS(statement, std::runtime_error);

still works fine.

Extra information

Might be related to #798.

@horenmar
Copy link
Member

horenmar commented Feb 9, 2017

Also a duplicate of #806.
The problem still is that since 1.7.0, Catch now relies on the passed expression being actual expression.

If you have C++11 or later available, just use lambdas.

@joto
Copy link
Author

joto commented Feb 10, 2017

Thanks for the quick answer. I am changing my code.

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

2 participants