digitalmars.D.bugs - [Issue 8711] New: Missing line number and bad error messages with a wrong functions array initialization
- d-bugmail puremagic.com (34/34) Sep 23 2012 http://d.puremagic.com/issues/show_bug.cgi?id=8711
- d-bugmail puremagic.com (41/41) Jan 02 2013 http://d.puremagic.com/issues/show_bug.cgi?id=8711
http://d.puremagic.com/issues/show_bug.cgi?id=8711 Summary: Missing line number and bad error messages with a wrong functions array initialization Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: diagnostic Severity: major Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: bearophile_hugs eml.cc This is correct code: int function(int)[] foos = [x => 0]; void main() {} This wrong program is the same, but it lacks the []: int function(int) foos = [x => 0]; void main() {} DMD 2.061alpha gives on the second program: temp.d(1): Error: cannot implicitly convert expression (__lambda2) of type int function(int x) pure nothrow safe to int(int) Error: no size for type int(int) Some problems: - The first line doesn't seem to mention that foos is not typed as an array. - The second error message lacks a line number: - I am not sure that "no size for ..." is correct. (This bug has severity 'major' as Don asked me for error messages missing line numbers.) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 23 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8711 yebblies <yebblies gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |yebblies gmail.com Platform|x86 |All OS/Version|Windows |All Severity|major |normal It is valid to initialize a pointer to T with an array of T, unless it is a function pointer. Lowering the priority because the first error _does_ have a line number, and the second is just nonsense. -493,13 +493,12 Initializer *ArrayInitializer::semantic(Scope *sc, Type *t, NeedInterpret needIn type = t; Initializer *aa = NULL; t = t->toBasetype(); switch (t->ty) { - case Tpointer: case Tsarray: case Tarray: break; case Tvector: t = ((TypeVector *)t)->basetype; break; case Taarray: // was actually an associative array literal aa = new ExpInitializer(loc, toAssocArrayLiteral()); return aa->semantic(sc, t, needInterpret); + case Tpointer: + if (t->nextOf()->ty != Tfunction) + break; default: error(loc, "cannot use array to initialize %s", type->toChars()); goto Lerr; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 02 2013