[Issue 17491] New: Compiles on invalid: *&s.init.var is not an lvalue
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jun 11 06:47:51 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17491
Issue ID: 17491
Summary: Compiles on invalid: *&s.init.var is not an lvalue
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ibuclaw at gdcproject.org
Test case:
---
struct S
{
int i;
}
void bug()
{
S.init = S(42); // OK -> (S).init is not an lvalue
*&S.init = S(42); // OK -> S(0) is not an lvalue
S.init.i = 42; // OK -> constant S(0).i is not an lvalue
*&S.init.i = 42; // Compiles!
}
---
Having a look at the AST dump:
---
import object;
struct S
{
int i;
}
void bug()
{
0 = 42; // <- This should be a compiler error.
}
RTInfo!(S)
enum typeof(null) RTInfo = null;
---
--
More information about the Digitalmars-d-bugs
mailing list