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
binarydmd
version v2.071.0
config/usr/local/bin/dmd.conf
parse compileFun
importall compileFun
importobject
(/Library/D/dmd/src/druntime/import/object.d)
importcore.attribute
(/Library/D/dmd/src/druntime/import/core/attribute.d)
importstd.stdio (/Library/D/dmd/src/phobos/std/stdio.d)
importcore.stdc.stdio
(/Library/D/dmd/src/druntime/import/core/stdc/stdio.d)
importcore.stdc.stdint
(/Library/D/dmd/src/druntime/import/core/stdc/stdint.d)
importcore.stdc.stddef
(/Library/D/dmd/src/druntime/import/core/stdc/stddef.d)
importcore.stdc.signal
(/Library/D/dmd/src/druntime/import/core/stdc/signal.d)
importcore.stdc.wchar_
(/Library/D/dmd/src/druntime/import/core/stdc/wchar_.d)
importcore.stdc.config
(/Library/D/dmd/src/druntime/import/core/stdc/config.d)
importcore.stdc.stdarg
(/Library/D/dmd/src/druntime/import/core/stdc/stdarg.d)
importcore.stdc.stdlib
(/Library/D/dmd/src/druntime/import/core/stdc/stdlib.d)
importcore.stdc.time
(/Library/D/dmd/src/druntime/import/core/stdc/time.d)
importcore.sys.posix.sys.types
(/Library/D/dmd/src/druntime/import/core/sys/posix/sys/types.d)
importcore.sys.posix.config
(/Library/D/dmd/src/druntime/import/core/sys/posix/config.d)
importstd.typecons (/Library/D/dmd/src/phobos/std/typecons.d)
importstd.meta (/Library/D/dmd/src/phobos/std/meta.d)
importstd.traits(/Library/D/dmd/src/phobos/std/traits.d)
importstd.typetuple
(/Library/D/dmd/src/phobos/std/typetuple.d)
importstd.stdiobase
(/Library/D/dmd/src/phobos/std/stdiobase.d)
importstd.range.primitives
(/Library/D/dmd/src/phobos/std/range/primitives.d)
semantic compileFun
importcore.stdc.errno
(/Library/D/dmd/src/druntime/import/core/stdc/errno.d)
importcore.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.