https://issues.dlang.org/show_bug.cgi?id=17769
Issue ID: 17769
Summary: dmd accepts conversion from shared(int)* to int* when
value comes from method
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: accepts-invalid
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
----
struct S()
{
shared(int)* method() { return ptr; }
shared(int)* ptr;
}
void main()
{
S!() s;
int* foo = s.method(); /* accepted; should be rejected */
}
----
These variations are correctly rejected:
----
auto foo = s.method();
int* bar = foo; // rejected as expected
int* baz = s.ptr; // ditto
----
--