D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23241 - __traits getMember breaks compilation when hit an alias
Summary: __traits getMember breaks compilation when hit an alias
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 All
: P1 blocker
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2022-07-13 01:11 UTC by ryuukk_
Modified: 2022-07-27 07:58 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ryuukk_ 2022-07-13 01:11:19 UTC
```
onlineapp.d(12): Error: first argument is not a symbol
```

```
module a;
import std;

@("hi")
void main()
{    
    alias THIS_MODULE = a;
    static foreach (member; __traits(allMembers, THIS_MODULE))
    {
        writeln("member: ", member);
        static foreach (attr; __traits(getAttributes, __traits(getMember, THIS_MODULE, member))) 
        {
            writeln("\tattribute: ", attr);
        }
    }
}

enum :int
{
    A, B, C
}

// commenting this out fixes it
alias MyEnum = int;
``` 

Expected behavior:

It should ignore either ignore the alias and compile, or support the alias
Comment 1 Dlang Bot 2022-07-13 02:54:35 UTC
@maxhaton created dlang/dmd pull request #14298 "Fix Issue 23241 - Consider types with no symbol (e.g. int) to have no…" fixing this issue:

- Fix Issue 23241 - Consider types with no symbol (e.g. int) to have no attributes

https://github.com/dlang/dmd/pull/14298
Comment 2 Dlang Bot 2022-07-27 07:58:36 UTC
dlang/dmd pull request #14298 "Fix Issue 23241 - Consider types with no symbol (e.g. int) to have no…" was merged into master:

- 251dbdf030280add92afea6fef45482926cc955d by mhh:
  Fix Issue 23241 - Consider types with no symbol (e.g. int) to have no attributes

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