Witam.
Od dłuższego czasu męczy mnie błąd "Invalid use of void expression". W całości wygląda tak:
AccountSystem\AccountSystem.cpp: In function 'bool DeleteAccount(std::__cxx11::string&)':
AccountSystem\AccountSystem.cpp:42:12: error: invalid use of void expression
}());
Kod wygląda tak:
Część kodu z AccountSsytem\AccountSystem.cpp->DeleteAccount()
ErrHandler(0, "AccountSystem/DeleteAccount", "Cannot access datafile with accounts.", false, true, [&AccPath](){
std::ofstream stream(AccPath.c_str());
stream << HCipher::encode("temp") << ' ' <<HCipher::encode("temp");
std::cout<<"Temporality account created. You can log in into them with login \"temp\" and password \"temp\"\nand then change login and password.";
stream.close();
}());
oraz deklaracja ErrHandler():
template <typename ErrCode>
bool ErrHandler(ErrCode code,
const char* function,
const char* msg,
bool IsFatal,
bool OtherAction = false,
void(*func)() = nullfunc)
Nie wiem w czym jest problem.
Z góry dziękuję za pomoc.
Pozdrawiam.
ErrHandler
?