When I am using ASSERT_TRUE() provided in Gtest I am getting below error.
return type does not match function type with an underline in VS 2010..
abc.h
#include "gtest\gtest.h"
class abc {
pubilc:
bool fun();
private:
bool fun1();
};
abc.c
bool abc::fun()
{
ASSERT_TRUE(fun1()); // Getting error: return type does not match function type
}
bool abc::fun1()
{
return true; // True or false depanding on operation
}
There is no
returnstatement specified infun()but it returns abool. Add areturn false;orreturn true;tofun()or change its return type tovoid:Based on My compiler complains that a constructor (or destructor) cannot return a value. What’s going on? which states (verbatim):
the
returntype must bevoidin functions that useASSERT_*()macros.