Bug 3728 – getOverloads and identifier traits

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2010-01-20T09:06:00Z
Last change time
2015-06-09T05:14:45Z
Assigned to
nobody
Creator
samukha

Attachments

IDFilenameSummaryContent-TypeSize
553patch.diffgetOverloads, identifier traitstext/plain2953

Comments

Comment #0 by samukha — 2010-01-20T09:06:49Z
For QtD, we need to get overloads of any function at compile time, not only virtuals. Currently we are using a seemingly working dmd modified with the patch attached. The patch also adds an 'identifier' trait, which allows to get symbol identifiers without parsing the value of stringof.
Comment #1 by samukha — 2010-01-20T09:09:47Z
Created attachment 553 getOverloads, identifier traits
Comment #2 by andrei — 2010-01-20T09:39:09Z
Given the size and visibility of Qt, I think it's fair to leave this as critical. I also voted for it :o).
Comment #3 by e.insafutdinov — 2010-01-20T10:08:35Z
(In reply to comment #2) > Given the size and visibility of Qt, I think it's fair to leave this as > critical. I also voted for it :o). Yeah, it actually is a blocker as you cannot use unpatched dmd for qtd. Thanks for voting. In fact this functionality was requested in the bug report 2855. The reason why we replace getVirtualFunctions with getOverloads rather than add the new one is because the functionality that the former provides could easily be achieved by filtering out the ouput of the latter with isVirtualFunction trait. That way we don't bloat __traits. The mentioned patch also provides isStaticFunction trait which we will eventually need.
Comment #4 by samukha — 2010-01-20T11:07:36Z
When implementing isStaticFunction, please make sure it returns true for any function that doesn't require a context pointer (even if there is no explicit STCstatic).
Comment #5 by bugzilla — 2010-01-22T02:37:22Z
Changeset 346
Comment #6 by e.insafutdinov — 2010-01-22T03:46:00Z
(In reply to comment #5) > Changeset 346 Thanks for applying the patch. Although there is a minor issue when building dmd on linux with gcc: traits.c:57: error: could not convert ‘f->FuncDeclaration::isVirtual’ to ‘bool’ traits.c:57: error: in argument to unary ! The fix is trivial, to add brackets to method call: f->isVirtual(). I didn't know that dmc can compile function calls without brackets.
Comment #7 by bugzilla — 2010-01-22T20:25:36Z
Added the (), changeset 347
Comment #8 by bugzilla — 2010-01-30T22:47:42Z
fixed dmd 2.040