← Back to index
|
Original Bugzilla link
Bug 7194 – [CTFE] Incorrect behaviour with pointers as local struct variable fields
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Windows
Creation time
2012-01-01T03:15:00Z
Last change time
2015-06-09T05:11:47Z
Assigned to
nobody
Creator
verylonglogin.reg
Comments
Comment #0
by verylonglogin.reg — 2012-01-01T03:15:04Z
--- struct S { int* p, p2; } int f() { assert(S().p == null); // passes assert(!S().p); // passes assert(S().p == S().p2); // passes auto s = S(); assert(!s.p); // passes, note: `s.p` also passes assert(s.p == null); // fails assert(s.p == s.p2); // fails return 0; } int g() { auto s = S(); assert(s.p); // passes but should fail return 0; } void t()() { enum e = g(); } // const for D1 static assert(f() == 0); // static assert is in a function because of @@@BUG3448@@@ aka @@@BUG965@@@ void f3448() { static assert(!__traits(compiles, t!()())); } // is(typeof()) for D1 ---
Comment #1
by bugzilla — 2012-01-04T18:25:27Z
https://github.com/D-Programming-Language/dmd/commit/51bc588d2e834650e5278247cd06b5da36569feb
https://github.com/D-Programming-Language/dmd/pull/602