[Issue 18546] Improvement: Implicit Class Template Instantiation

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 2 03:37:01 UTC 2018


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

Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang at jmdavisProg.co
                   |                            |m
           Hardware|x86_64                      |All
                 OS|Linux                       |All

--- Comment #1 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
The normal solution is to use a factory function which can then take advantage
of IFTI. As it stands, the compiler never does any implicit template
instantations except for functions, because for templates that aren't function
templates, it's ambiguous. This particular case is a bit special in that it's
using the type, not a function, but it's also triggering the constructor, which
_is_ a function. So, I don't know. Really, what it comes down to is that some
specific cases of implicitly instantiating templated types could be made to
work, but it can't work in the general case. So, thus far, the solution has
been to simply not support it.

Related: issue #1012.

--


More information about the Digitalmars-d-bugs mailing list