Missing return value error not present with template

Tony tonytdominguez at aol.com
Wed Nov 15 08:43:01 UTC 2017


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.


More information about the Digitalmars-d-learn mailing list