Bug 24150 – Wrong deprecation using typeof on a member is private from different module
Status
RESOLVED
Resolution
WORKSFORME
Severity
minor
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2023-09-18T21:49:58Z
Last change time
2023-09-20T13:28:47Z
Assigned to
No Owner
Creator
apham
Comments
Comment #0 by apz28 — 2023-09-18T21:49:58Z
module bug2;
struct S
{
public:
int pubInt;
@property int pubGet() { return 1; }
private:
int priInt;
@property int priGet() { return 2; }
}
module bug;
import bug2;
void main(string[] argv)
{
alias pubInt = __traits(getMember, S, "pubInt");
pragma(msg, typeof(pubInt).stringof);
alias pubGet = __traits(getMember, S, "pubGet");
pragma(msg, typeof(pubGet).stringof);
alias priInt = __traits(getMember, S, "priInt");
pragma(msg, typeof(priInt).stringof);
alias priGet = __traits(getMember, S, "priGet");
pragma(msg, typeof(priGet).stringof);
}
--output as below
int
int
int
C:\Development\Projects\DLang\std\test\bug\bug.d(17): Deprecation: function `bug2.S.priGet` of type `@property int()` is not accessible from module `bug`
int
Comment #1 by razvan.nitu1305 — 2023-09-20T10:10:41Z
You might be using an older version of the compiler. I cannot reproduce this with the latest version of master.