[Issue 10547] DMD accepts function templates with no body.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 5 03:29:15 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=10547


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #1 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-07-05 03:29:14 PDT ---
Current implementation allows to split template declaration and template
definition. You can place template declaration in .di file, full definition in
.d file and instantiate template with specific arguments. In module, which
imports .di file you can instantiate template if parameters match to those used
in .d file (this is limitation as due to separate compilation it is impossible
to know beforehand all potential parameters). Since instantiated function has
no body, dmd issues reference to external symbol and the trick works (in such
case compiler does not need template body but linker must find referenced
symbols). This allows to hide template definitions in D at the cost of reducing
potential possible parameters.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list