Fix adding Opts with | to lvalue Parser

This is the recommended way of adding new Opts in our documentation
for using custom main, but we did not compile the code to see if it
works. We now compile the example as part of the BUILD_EXAMPLES
option.

Fixes #2787
This commit is contained in:
Martin Hořeňovský
2024-01-02 23:27:13 +01:00
parent f981c9cbca
commit 863c662c0e
3 changed files with 45 additions and 1 deletions

View File

@@ -673,7 +673,9 @@ namespace Catch {
template <typename T>
friend Parser operator|( Parser const& p, T&& rhs ) {
return Parser( p ) |= CATCH_FORWARD(rhs);
Parser temp( p );
temp |= rhs;
return temp;
}
template <typename T>