D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 19833 - The member as template cannot be acquired by getMember
Summary: The member as template cannot be acquired by getMember
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P1 regression
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2019-04-27 09:23 UTC by SHOO
Modified: 2019-04-29 10:42 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description SHOO 2019-04-27 09:23:54 UTC
This code doesn't work in dmd-beta/dmd-nightly, but work in dmd 2.085.1:

------------------
struct Test
{
    template Temp(int x)
    {
        enum xxx = x;
    }
}

void main()
{
    import std.stdio;
    alias TT1 = Test.Temp;
    writeln(TT1!1.xxx);
    // Expect the same behavior as above,
    // but in fact, an error occurs.
    /* Error: __traits(getMember, Test, "Temp") does not give a valid type */
    alias TT2 = __traits(getMember, Test, "Temp");
    writeln(TT2!2.xxx);
}
------------------
Comment 1 JR 2019-04-27 23:13:54 UTC
By extension this also breaks things like getSymbolsByUDA whenever there's a template.

https://run.dlang.io/is/wpuGoo
Comment 2 Dlang Bot 2019-04-28 19:13:44 UTC
@kubo39 created dlang/dmd pull request #9723 "Fix Issue 19833 - The member as template cannot be acquired by getMember" fixing this issue:

- Fix Issue 19833 - The member as template cannot be acquired by getMember

https://github.com/dlang/dmd/pull/9723
Comment 3 Hiroki Noda 2019-04-28 19:22:51 UTC
I guess regression since https://github.com/dlang/dmd/commit/2af3013860da8f9525cdad7fa17092c2629bf2e0
Comment 4 Dlang Bot 2019-04-29 10:42:47 UTC
dlang/dmd pull request #9723 "Fix Issue 19833 - The member as template cannot be acquired by getMember" was merged into stable:

- 74f850e23a831c231b2346c3aa832488f3ce60ad by Hiroki Noda:
  Fix Issue 19833 - The member as template cannot be acquired by getMember

https://github.com/dlang/dmd/pull/9723