Bug 1872 – getVirtualFunctions should return empty if called for a field
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2008-02-26T23:11:00Z
Last change time
2015-06-09T01:14:35Z
Keywords
diagnostic, rejects-valid
Assigned to
bugzilla
Creator
dhasenan
Comments
Comment #0 by dhasenan — 2008-02-26T23:11:21Z
class Bar
{
int snafu;
}
string foo()
{
string s = ``;
foreach (i, m; __traits(getVirtualFunctions, Bar, "snafu"))
{
s ~= `0`;
}
return s;
}
foo() should return the empty string. Instead, it fails to compile with an obscure error message:
test1
0x8171160 typedot type=foreach_virtualfuncs_field.Bar
foreach_virtualfuncs_field.d(9): Error: 'this' is only allowed in non-static member functions, not foo
foreach_virtualfuncs_field.d(9): Error: this for snafu needs to be type Bar not type int
test2
Comment #1 by dhasenan — 2008-02-27T07:28:52Z
*** This bug has been marked as a duplicate of 1723 ***