Returning a void?

Viewed 1108

I do not understand why this code compiles without error:

#include <iostream>

template <class T>
struct Test
{
    static constexpr T f() {return T();} 
};

int main()
{
    Test<void> test;
    test.f(); // Why not an error?
    return 0;
}

Is it ok according to the standard, or is it a compiler tolerance?

3 Answers
Related