digitalmars.D.bugs - [Issue 5163] New: meaningless error message with front() applied to void[]
- d-bugmail puremagic.com (32/32) Nov 04 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5163
- d-bugmail puremagic.com (21/21) Nov 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5163
- d-bugmail puremagic.com (21/21) Nov 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5163
- d-bugmail puremagic.com (11/13) Nov 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5163
- d-bugmail puremagic.com (7/7) Nov 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5163
- d-bugmail puremagic.com (15/15) Nov 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=5163
http://d.puremagic.com/issues/show_bug.cgi?id=5163 Summary: meaningless error message with front() applied to void[] Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: diagnostic, rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: mrmocool gmx.de import std.array; void main() { void[] a = cast(void[]) [ 1, 2, 3 ]; a.front; } yields: ..\src\phobos\std\array.d(419): Error: [i] has no effect in expression (a[0u]) ..\src\phobos\std\array.d(5): Error: template instance std.array.front!(void[]) error instantiating Originally I used std.file.read(), hence the void array. - 1st message is completely senseless, what "[i]"? - 2nd message shows line 5 which is the line of "a.front;" but the filename is wrong. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 04 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5163 Lars T. Kyllingstad <bugzilla kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla kyllingen.net Component|DMD |Phobos 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: -------
Nov 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5163 Lars T. Kyllingstad <bugzilla kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED 05:18:35 PDT --- This fixes the Phobos bug: http://www.dsource.org/projects/phobos/changeset/2123 The error message is now: test.d(6): Error: template std.array.front(A) if (is(typeof(A[0])) && !isNarrowString!(A) && !is(typeof(A[0]) : const(void))) does not match any function template declaration test.d(6): Error: template std.array.front(A) if (is(typeof(A[0])) && !isNarrowString!(A) && !is(typeof(A[0]) : const(void))) cannot deduce template function from argument types !()(void[]) Arguably less readable, but more useful since it refers to the point of error in user code instead of in Phobos code. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5163 bearophile_hugs eml.cc changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bearophile_hugs eml.ccArguably less readable, but more useful since it refers to the point of error in user code instead of in Phobos code.Too bad there is no handy way to add error messages to template constraints... -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5163 Thx for the fix, but I still think that strange [i] in the error message is a diagnostic bug, reopen it? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5163 Lars T. Kyllingstad <bugzilla kyllingen.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|rejects-valid | 02:26:24 PST --- I think '[i]' is just a compact way of saying 'indexing operation'. I guess it be a message saying that you can't index into void[] arrays.) Anyway, I suggest you open a new bug report about it. It's better not to have two bugs in one report -- especially when one is a Phobos bug and the other is a DMD bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 08 2010