Sorry, wrong version of the code is attached. Here is the offending code:
struct lr1 {
lr1* a;
}
template proxy(T) {
private alias G = gen!T;
static if (is(typeof(G.str)))
enum str = G.str;
}
template gen(T) if (is(T == struct)) {
enum str = T.stringof;
private enum xstr = gen!(lr1*).str;
}
template gen(T: S*, S) {
private alias rc = proxy!S;
//pragma(msg, __traits(allMembers, rc));
enum str = rc.str~"_ptr";
}
enum tmp = proxy!lr1.str;
Comment #2 by yshuiv7 — 2018-08-25T15:54:51Z
The behavior of the compiler seems to be sensitive to pragma:
...
// This is the second `gen`
template gen(T: S*, S) {
private alias rc = proxy!S;
pragma(msg, is(typeof(rc.str))); // false
//pragma(msg, __traits(allMembers, rc));
enum str = rc.str~"_ptr";
}
Above version generate:
package.d(19): Error: variable `package.gen!(lr1*, lr1).str` had semantic errors when compiling