[Issue 5163] meaningless error message with front() applied to void[]

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 5 04:39:32 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5163


Lars T. Kyllingstad <bugzilla at kyllingen.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at kyllingen.net
          Component|DMD                         |Phobos


--- Comment #1 from Lars T. Kyllingstad <bugzilla at kyllingen.net> 2010-11-05 04:38:32 PDT ---
This is actually two separate issues.

The first is a Phobos issue, namely that there should be a template constraint
on std.array.front() that prevents it from being instantiated on void[] arrays.
 front() is defined as something like

    T front(T)(T[] array) { return array[0]; }

You cannot index into a void[] array, hence the first error message.  This also
means that void[] cannot be a range.

The second is the issue of the wrong line number, which is a bug in DMD. I'm
guessing it's just bug 1913 again, so I'm marking this one as a Phobos issue.


In the case of a void[] returned from std.file.read(), you need to cast it to
ubyte[] before using it as a range.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list