[Issue 23916] Non-eponymous template instances have a "type" (void)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 12 18:10:30 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23916

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nick at geany.org

--- Comment #1 from Nick Treleaven <nick at geany.org> ---
template X() {}

It was decided that typeof(X) is void, that's in the spec. I'm not sure if the
type of a template instance is defined in the spec. A template instance seems
similar to a module. However `typeof(std.math)` is a compile error.

void fun()
{
    return X!();
}

Note: You are allowed to return an expression of type void, this is useful in
generic code.

--


More information about the Digitalmars-d-bugs mailing list