Im trying to compile an example from the Cryptosuite for Arduino. Im getting this error:
In file included from sha1test.pde:1:
C:\Program Files (x86)\Arduino\libraries\Sha/sha1.h:26: error: conflicting return type specified for 'virtual void Sha1Class::write(uint8_t)'
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Print.h:48: error: overriding 'virtual size_t Print::write(uint8_t)'
virtual void write(uint8_t);
The overriding function has a return type of
void while the overridden function has a return type of
size_t. That's illegal. Per the standard, "The return type of an overriding function shall be either identical to the return type of the overridden function or covariant with the classes of the functions" (C++ 10.3.5, both the 2003 and 2011 versions of the standard).
The standard goes on to discuss what it means for return types to be "covariant". That has to do with pointers and references to classes. My advice: Take the easy way out and always make the return types identical. Then you don't have to worry about whether the return types from an overridden and overriding virtual function are covariant.
In this case,
size_t are neither identical nor covariant.