[Issue 8711] Missing line number and bad error messages with a wrong functions array initialization
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jan 2 07:20:24 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8711
yebblies <yebblies at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |yebblies at gmail.com
Platform|x86 |All
OS/Version|Windows |All
Severity|major |normal
--- Comment #1 from yebblies <yebblies at gmail.com> 2013-01-03 02:20:22 EST ---
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: -------
More information about the Digitalmars-d-bugs
mailing list