On Wednesday, 15 November 2017 at 08:43:01 UTC, Tony wrote:
This code:
class MyClass {
public:
int SomeMethod ()
{
}
}
void main()
{
}
gets a compile error:
Error: function test_warnings.MyClass.SomeMethod has no return
statement, but is expected to return a value of type int
but if I make it a template class:
class MyClass(T) {
there is no compile error. I don't know why the error isn't
given for the template code as well.
Because it's a template! If you try to instantiate it, it gives
the same error. For example MyClass!int a;