[Issue 18269] Inconsistent string representation of delegate @system attribute

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Aug 14 06:27:20 UTC 2020


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

Boris Carvajal <boris2.9 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris2.9 at gmail.com

--- Comment #7 from Boris Carvajal <boris2.9 at gmail.com> ---
I checked the issue a few months ago, this is what I recall.

The problem here is that both 'void delegate()' and 'void delegate() @system'
are mangled in the same way because @system isn't coded in the mangle system
(it's the same as a function without attributes), so the types are identical to
any compiler comparison and that includes template instantiation.
Whatever is seen first by the compiler then it's inserted to the type table and
that is the type used by any function templates.

Second, there's a special code path in the presence of default arguments that
just passes the original argument to the template, here is 'func' with the
@system flag enabled, not the one in the type table (alias T = void
delegate()), this peculiarity is orthogonal to the main issue.

Possible solutions are:
1. Integrate @system attribute in the mangle system.
2. That .stringof just print the naked functions (no attributes) with @system.
3. or better, save the type of these functions in the type table with the
@system flag enabled (or @safe in the hypothetical case of safe by default).

2 and 3 mean the compiler should now interpret ("no attributes" == @system)

--


More information about the Digitalmars-d-bugs mailing list