Bug 18406 – __traits( getOverloads ) doesn't accept module symbols as its aggregate parameter

Status
RESOLVED
Resolution
INVALID
Severity
critical
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2018-02-09T06:22:28Z
Last change time
2018-02-09T06:45:21Z
Assigned to
No Owner
Creator
Ethan Watson

Attachments

IDFilenameSummaryContent-TypeSize
1680testmodule.dCode exampleapplication/x-dsrc382

Comments

Comment #0 by gooberman — 2018-02-09T06:22:28Z
Created attachment 1680 Code example From the documentation, "The first argument is an aggregate (e.g. struct/class/module)." This gets further complicated when doing an allMembers pass of a module with an overloaded function - the function symbol will show up multiple times, but since you cannot get the overloads you can only resolve the first overload encountered by the compiler. Code example attached. Uses __traits( parent ) to get the module symbol. Other methods of obtaining the symbol, such as mixing in the name and assigning to an alias, result in the exact same error. Expected result: NumOverloads gets the value 2 assigned to it Actual result: Error message: expression expected as second argument of __traits getOverloads
Comment #1 by gooberman — 2018-02-09T06:45:21Z
Turns out I'm just a rookie. You need to stringify the final parameter if necessary...