[Issue 4623] Non-integer type allowed as static array size
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Sep 29 12:43:39 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4623
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |patch
CC| |clugdbug at yahoo.com.au
--- Comment #1 from Don <clugdbug at yahoo.com.au> 2010-09-29 12:43:23 PDT ---
PATCH mtype.c, TypeSArray::semantic(), line 3344.
dinteger_t d1 = dim->toInteger();
- dim = dim->castTo(sc, tsize_t);
+ dim = dim->implicitCastTo(sc, Type::tsize_t);
dim = dim->optimize(WANTvalue);
dinteger_t d2 = dim->toInteger();
if (dim->op == TOKerror)
goto Lbaddim;
if (d1 != d2)
goto Loverflow;
... and further down:
Loverflow:
error(loc, "index %jd overflow for static array", d1);
+ Lbaddim:
dim = new IntegerExp(0, 1, tsize_t);
TEST CASE for test suite
//bug 4623
static assert( !is (typeof(() {int[123.1] x; return x; })));
I've done this patch in a relatively complicated way, so that something like:
int[7654321.0] bug4623b;
generates only one error message, not two.
--
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