Frage

Ich erhalte einen Kompilationsfehler bei der Verwendung der folgenden Google Mock Deklaration: generasacodicetagpre.

Der Fehler ist: generasacodicetagpre.

Was mache ich falsch?


Updates:

Ich verwende VS2010.

Die Deklaration von Somefunction ist: generasacodicetagpre.

a () ist ein Google Mock Wildcard Matcher mit folgendemDefinition: generasacodicetagpre.

Eine vereinfachte, aber repräsentative Version der Struktur ist: generasacodicetagpre.

War es hilfreich?

Lösung

The solution was to change the declaration from:

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

to

EXPECT_CALL(some_object, someFunction(1,An<const AStructIDefined &>()))
    .Times(2);

C++ implicitly casts const and reference & on function parameters, but google mock's declaration seems to require the type appearing in the function's signature and not the type submitted as a parameter to the function.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top