Bug 7420 – Duplicate "cannot be read at compile time" error messages

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-02-01T11:50:00Z
Last change time
2015-06-09T05:11:38Z
Keywords
diagnostic
Assigned to
andrej.mitrovich
Creator
clugdbug

Comments

Comment #0 by clugdbug — 2012-02-01T11:50:11Z
int x = 2; char[] y = "abc".dup; static assert(x < 4); static assert(y == "abc"); static assert(cast(ubyte[])y != null); static assert(y[0] == 1); static assert(y[0..1].length == 1); ----- BEFORE PATCH --- crash.d(405): Error: variable x cannot be read at compile time crash.d(405): Error: variable x cannot be read at compile time crash.d(405): while evaluating: static assert(x < 4) crash.d(406): Error: variable y cannot be read at compile time crash.d(406): Error: variable y cannot be read at compile time crash.d(406): while evaluating: static assert(y == "abc") crash.d(407): Error: variable y cannot be read at compile time crash.d(407): Error: variable y cannot be read at compile time crash.d(407): while evaluating: static assert(cast(ubyte[])y != null) crash.d(408): Error: variable y cannot be read at compile time crash.d(408): Error: variable y cannot be read at compile time crash.d(408): while evaluating: static assert(cast(int)y[0u] == 1) crash.d(409): Error: variable y cannot be read at compile time crash.d(409): Error: variable y cannot be read at compile time crash.d(409): while evaluating: static assert(y[0u..1u].length == 1u) ---- AFTER PATCH --- crash.d(405): Error: variable x cannot be read at compile time crash.d(405): while evaluating: static assert(x < 4) crash.d(406): Error: variable y cannot be read at compile time crash.d(406): while evaluating: static assert(y == "abc") crash.d(407): Error: variable y cannot be read at compile time crash.d(407): while evaluating: static assert(cast(ubyte[])y != null) crash.d(408): Error: variable y cannot be read at compile time crash.d(408): while evaluating: static assert(cast(int)y[0u] == 1) crash.d(409): Error: variable y cannot be read at compile time crash.d(409): while evaluating: static assert(y[0u..1u].length == 1u)
Comment #1 by github-bugzilla — 2012-11-10T06:46:40Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/550c25d09939a031727d9ae0731477db31e3980f Fixes Issue 7420 - Return ErrorExp on error to avoid duplicate errors. Force 32bit diagnostics for test-case. https://github.com/D-Programming-Language/dmd/commit/81585953effd2beebdac7bf6be49f4379403b7f3 Merge pull request #1200 from AndrejMitrovic/Fix7420 Fix Issue 7420 - Duplicate "cannot be read at compile time" error messages