Google Mock - using :: testing :: An ()

Я получаю ошибку компиляции при использовании следующего объявления Google Mock :

EXPECT_CALL(some_object, someFunction(1,An()))
    .Times(2);

Ошибка:

1>ClCompile:
1>  TestMyClass.cpp
1>TestMyClass.cpp(189): error C2664: 'mynamespace::MockMyClassClient::gmock_someFunction' : cannot convert parameter 2 from 'testing::Matcher' to 'const testing::Matcher &'
1>          with
1>          [
1>              T=mynamespace::AStructIDefined
1>          ]
1>          and
1>          [
1>              T=const mynamespace::AStructIDefined &
1>          ]
1>          Reason: cannot convert from 'testing::Matcher' to 'const testing::Matcher'
1>          with
1>          [
1>              T=mynamespace::AStructIDefined
1>          ]
1>          and
1>          [
1>              T=const mynamespace::AStructIDefined &
1>          ]
1>          No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

Что я делаю не так?


ОБНОВЛЕНИЯ:

Я использую VS2010.

Объявление someFunction выглядит следующим образом:

virtual void someFunction( long long ll, const AStructIDefined& a_struct);

An () - это средство сопоставления подстановочных знаков Google Mock со следующим определением:

// Creates a matcher that matches any value of the given type T.
template 
inline Matcher An() { return A(); }

Упрощенная, но репрезентативная версия структуры:

namespace mynamespace {

class ABaseCLass
{
public:
    virtual ~ABaseCLass(){};
    virtual bool isValid() const = 0;
};

struct AStructIDefined : public ABaseCLass
{
public:
    OrderStatusReport(SomeEnum1 e_, int i_, double d_);

    SomeEnum1 e;
    int i;
    double d;

    const std::string toString() const;
    bool isSane() const;
    bool operator== (const SomeEnum1& ref_) const;
    double getD() const;
    int getI() const;
    bool isCondition() const;
};

} // namespace mynamespace

6
задан Jonathan 20 February 2011 в 12:22
поделиться