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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 12 18:20:24 UTC 2023


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

--- Comment #2 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
(In reply to Nick Treleaven from comment #1)
> 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.

Any reason not to revise and deprecate this?

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

Yes. Although, it is an accidental, half-finished feature. You cannot have void
variables or function parameters. Ironically however, you can have noreturn
variables and function parameters.

--


More information about the Digitalmars-d-bugs mailing list