[Issue 17845] [ICE] backend\cgcod.c 1677
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Thu Sep 21 09:13:38 UTC 2017
    
    
  
https://issues.dlang.org/show_bug.cgi?id=17845
--- Comment #2 from Mr. Smith <mrsmith33 at yandex.ru> ---
Looks like the problem is with the use of delegate. When switching to function
it works.
---
void main()
{
    struct Row
    {
        @Column!Row((ref Row r, scope SinkT s){ s("test"); })
        uint fileSize;
    }
    auto formatters = parseRowInfo!Row;
}
alias SinkT = void delegate(const(char)[]);
// Internal error: ddmd\backend\cgcod.c 1677 when function -> delegate
alias Formatter(Row) = void function(ref Row row, scope SinkT sink);
struct Column(Row)
{
    Formatter!Row formatter;
}
Formatter!Row[] parseRowInfo(Row)()
{
    import std.traits;
    Formatter!Row[] formatters;
    Row r;
    foreach(string memberName; __traits(allMembers, Row))
    {
        foreach(attr; __traits(getAttributes, __traits(getMember, r,
memberName)))
        {
            static if (is(typeof(attr) == Column!Row))
            {
                formatters ~= attr.formatter;
            }
        }
    }
    return formatters;
}
---
--
    
    
More information about the Digitalmars-d-bugs
mailing list