@@ -472,13 +472,15 @@ template <typename F>
472472class ExpectationFunc : public Expectation <decltype (std::declval<F>()())> {
473473 static_assert (Util::is_functional<F>::value,
474474 " Error! ExpectationFunc can only contaion lambdas." );
475+
476+ typedef decltype (std::declval<F>()()) block_ret_t;
475477 F block;
476- std::shared_ptr<decltype (std::declval<F>()()) > computed = nullptr ;
478+ std::shared_ptr<block_ret_t > computed = nullptr ;
477479
478480 public:
479481 ExpectationFunc (ExpectationFunc<F> const ©)
480- : Expectation<decltype (std::declval<F>()()) >(copy), block(copy.block) {}
481-
482+ : Expectation<block_ret_t >(copy), block(copy.block) {}
483+
482484 /* *
483485 * @brief Create an ExpectationValue using a value.
484486 *
@@ -487,8 +489,8 @@ class ExpectationFunc : public Expectation<decltype(std::declval<F>()())> {
487489 * @return The constructed ExpectationValue.
488490 */
489491 ExpectationFunc (ItBase &it, F block)
490- : Expectation<decltype (block()) >(it), block(block) {}
491-
492+ : Expectation<block_ret_t >(it), block(block) {}
493+
492494 /* *
493495 * @brief Create an Expectation using a function.
494496 *
@@ -507,9 +509,9 @@ class ExpectationFunc : public Expectation<decltype(std::declval<F>()())> {
507509 // {}
508510
509511 /* * @brief Get the target of the expectation. */
510- decltype (block()) &get_target () & override {
511- if (! computed) {
512- computed = std::make_shared<decltype ( block ()) >(block ());
512+ block_ret_t &get_target () & override {
513+ if (computed == nullptr ) {
514+ computed = std::make_shared<block_ret_t >(block ());
513515 }
514516 return *computed;
515517 }
0 commit comments