On Tuesday, 18 October 2016 at 11:06:08 UTC, wobbles wrote:
On Tuesday, 18 October 2016 at 08:21:09 UTC, Daniel Kozak wrote:
Try to compile this:

import std.stdio;

auto xxx(T)()
{
     return this;
}

struct S
{
    mixin xxx!(typeof(this));
    alias xxx this;
}

void foo(S pos)
{
    writefln("(%.2f|%.2f)", pos.x, pos.y);
}

void main()
{
}


Or this:

import std.stdio;

auto xxx(T)()
if (is(T == struct))
{
     return this;
}

struct Vector2f
{
    mixin xxx!(typeof(this));
    alias xxx this;
}

void foo(ref const Vector2f pos) {}

void main()
{
    Vector2f v;
    foo(v);
}

Compiler bug?

Looks like it's constantly going in circles trying to figure out what the hell 'xxx' is :) I cancelled compilation after a minute of 100% CPU usage so not sure if it will ever finish.

With -v on, this is what it prints:
dmd compileFun.d -v
binary    dmd
version   v2.071.0
config    /usr/local/bin/dmd.conf
parse     compileFun
importall compileFun
import object (/Library/D/dmd/src/druntime/import/object.d) import core.attribute (/Library/D/dmd/src/druntime/import/core/attribute.d)
import    std.stdio     (/Library/D/dmd/src/phobos/std/stdio.d)
import core.stdc.stdio (/Library/D/dmd/src/druntime/import/core/stdc/stdio.d) import core.stdc.stdint (/Library/D/dmd/src/druntime/import/core/stdc/stdint.d) import core.stdc.stddef (/Library/D/dmd/src/druntime/import/core/stdc/stddef.d) import core.stdc.signal (/Library/D/dmd/src/druntime/import/core/stdc/signal.d) import core.stdc.wchar_ (/Library/D/dmd/src/druntime/import/core/stdc/wchar_.d) import core.stdc.config (/Library/D/dmd/src/druntime/import/core/stdc/config.d) import core.stdc.stdarg (/Library/D/dmd/src/druntime/import/core/stdc/stdarg.d) import core.stdc.stdlib (/Library/D/dmd/src/druntime/import/core/stdc/stdlib.d) import core.stdc.time (/Library/D/dmd/src/druntime/import/core/stdc/time.d) import core.sys.posix.sys.types (/Library/D/dmd/src/druntime/import/core/sys/posix/sys/types.d) import core.sys.posix.config (/Library/D/dmd/src/druntime/import/core/sys/posix/config.d)
import    std.typecons  (/Library/D/dmd/src/phobos/std/typecons.d)
import    std.meta      (/Library/D/dmd/src/phobos/std/meta.d)
import    std.traits    (/Library/D/dmd/src/phobos/std/traits.d)
import std.typetuple (/Library/D/dmd/src/phobos/std/typetuple.d) import std.stdiobase (/Library/D/dmd/src/phobos/std/stdiobase.d) import std.range.primitives (/Library/D/dmd/src/phobos/std/range/primitives.d)
semantic  compileFun
import core.stdc.errno (/Library/D/dmd/src/druntime/import/core/stdc/errno.d) import core.stdc.string (/Library/D/dmd/src/druntime/import/core/stdc/string.d)
entry     main          compileFun.d
semantic2 compileFun
semantic3 compileFun


And sticsk on semantic3 forever.

Reply via email to