Bug 7988 – [CTFE] CTFE return values should be allowed in compile-time expressions

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-04-26T01:19:00Z
Last change time
2015-06-09T05:11:34Z
Keywords
CTFE, rejects-valid
Assigned to
nobody
Creator
clugdbug
Blocks
1982, 8253, 8255, 8285

Comments

Comment #0 by clugdbug — 2012-04-26T01:19:17Z
Things like this should work. It currently doesn't because CTFE ends when the function finishes. class X7988 { int y; this() { y = 2; }} static assert( (new X7988).y == 2);
Comment #1 by github-bugzilla — 2013-07-12T14:07:10Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9d8d7864c85f4e07be7a7d24ba92108f2206b9f4 Fix issue 7988 allow CTFE return values in compile-time exprs Test case only. This bug was fixed by doing constfolding in CTFE. https://github.com/D-Programming-Language/dmd/commit/a0ba3b2aa31d93709a1ed3e21f5a2deca6c761fc Merge pull request #2339 from donc/fourCTFEtestcases Test cases for bugs 1982, 7988, 8253, and 8285.