← Back to index
|
Original Bugzilla link
Bug 11756 – Irrelevant variable name printing in CTFE error message
Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-17T02:32:00Z
Last change time
2013-12-17T03:45:37Z
Keywords
CTFE, diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0
by k.hara.pg — 2013-12-17T02:32:58Z
This code will correctly fail to CTFE at line 5, but printed error message is weird. struct Ptr { void opAssign(Ptr other) { (*cnt)--; // Line 5 cnt = other.cnt; (*cnt)++; } size_t *cnt; } union Foo { size_t *ptr1; Ptr ptr2; } bool test() { Foo foo; size_t cnt = 1; foo.ptr1 = &cnt; size_t n; foo.ptr2 = Ptr(&n); assert(cnt == 0); return true; } static assert(test()); Output: test.d(5): Error: cannot read uninitialized variable ptr1 in CTFE <-- ptr1? test.d(24): called from here: foo.ptr2.opAssign(Ptr(& n)) test.d(29): called from here: test() test.d(29): while evaluating: static assert(test()) Expected error message for line 5 is: test.d(5): Error: cannot read uninitialized variable cnt in CTFE <-- cnt
Comment #1
by k.hara.pg — 2013-12-17T02:38:20Z
https://github.com/D-Programming-Language/dmd/pull/2977
Comment #2
by github-bugzilla — 2013-12-17T03:45:26Z
Commits pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/e9d52b71f4cf7bfb5a2beb2dc6e1d9c83926b71e
fix Issue 11756 - Irrelevant variable name printing in CTFE error message
https://github.com/D-Programming-Language/dmd/commit/83728b9139323aa8a5d29176f8e14540307a45e5
Merge pull request #2977 from 9rnsr/fix11756 Issue 11756 - Irrelevant variable name printing in CTFE error message