Re: template instantiation problems

2020-01-14 Thread Boris Carvajal via Digitalmars-d-learn
On Friday, 10 January 2020 at 18:31:59 UTC, ag0aep6g wrote: import m1 = foo.baz; import m2 = foo; alias p = __traits(parent, m1); pragma(msg, m1.stringof); /* "module baz", ok */ pragma(msg, m2.stringof); /* "module foo", ok */ pragma(msg, p.stringof); /* "package foo", ok */ enum e(alias

Re: template instantiation problems

2020-01-10 Thread ag0aep6g via Digitalmars-d-learn
On 10.01.20 18:27, berni44 wrote: This clearly shows, that packageName is only instatiated once at top level although mod0 and mod1 are two different things (at least their stringof produces different results) and therefore should be instantiated twice. Now I don't know if this is a bug in DM

template instantiation problems

2020-01-10 Thread berni44 via Digitalmars-d-learn
I'm trying to understand issue 17441 [1]. I reduced it (including Phobos) to the following (and added some message to point out the problem): test.d: --- alias parentOf(alias sym) = __traits(parent, sym); template packageName(alias T) { pragma(msg, "IN: ", T.stringof); static if (__tra