Thread overview | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 01, 2007 [Issue 1253] New: DMD 0.175 introduced bug: array initializers as expressions are not allowed? | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=1253 Summary: DMD 0.175 introduced bug: array initializers as expressions are not allowed? Product: D Version: 0.175 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: oskar.linde@gmail.com void main() { struct T { int a; int b;} const T[] arr = [{1,1},{2,2}]; T[] arr2 = arr.dup; assert(arr2 == arr); } Gives: test.d:3: Error: array initializers as expressions are not allowed test.d:3: Error: array initializers as expressions are not allowed Interestingly, commenting out the assert line makes the code compile. changing const -> static also makes the code compile. The bug is confirmed to exist on 0.175, 0.176, 0.178, 1.006, 1.007, 1.013 (gdc 0.23) and 1.014 On DMD 0.174 (and earlier), the code compiles ok. -- |
June 01, 2007 [Issue 1253] DMD 0.175 introduced bug: array initializers as expressions are not allowed? | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1253 smjg@iname.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |smjg@iname.com Severity|major |regression -- |
August 25, 2007 [Issue 1253] DMD 0.175 introduced bug: array initializers as expressions are not allowed? | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1253 ------- Comment #1 from thomas-dloop@kuehne.cn 2007-08-25 16:42 ------- Added to DStress as http://dstress.kuehne.cn/run/s/struct_initialization_11_A.d http://dstress.kuehne.cn/run/s/struct_initialization_11_B.d http://dstress.kuehne.cn/run/s/struct_initialization_11_C.d -- |
May 11, 2008 [Issue 1253] DMD 0.175 introduced bug: array initializers as expressions are not allowed? | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1253 ------- Comment #2 from terranium@yandex.ru 2008-05-11 10:38 ------- exists in 2.012, doesn't depend on asserts struct A { int a,b; } void f() { A[2] rg=[{1,2},{1,2}]; } -- |
May 11, 2008 [Issue 1253] DMD 0.175 introduced bug: array initializers as expressions are not allowed? | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1253 ------- Comment #3 from terranium@yandex.ru 2008-05-11 10:51 ------- workaround :-/ struct A { int a,b; } void f() { A[2] rg=[A(1,2),A(3,4)]; } -- |
September 30, 2008 [Issue 1253] DMD 0.175 introduced bug: array initializers as expressions are not allowed? | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1253 ------- Comment #4 from terranium@yandex.ru 2008-09-30 04:47 ------- other initialization-related info bug 2096, bug 2170, bug 2356, bug 2375 -- |
September 01, 2009 [Issue 1253] array initializers as expressions are not allowed in const arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1253 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au Version|0.175 |2.022 Summary|DMD 0.175 introduced bug: |array initializers as |array initializers as |expressions are not allowed |expressions are not |in const arrays |allowed? | Severity|regression |normal --- Comment #5 from Don <clugdbug@yahoo.com.au> 2009-09-01 07:33:56 PDT --- This works for me on D1.046. It was fixed somewhere between 1.020 and 1.041. It also works on DMD2.031, if you change 'const' to 'enum' to preserve the semantics. Oddly, however, on DMD2.031 the code as-written still displays: bug.d(173): Error: array initializers as expressions are not allowed So this is now a D2-only bug, which is not a regression. It's never worked with these semantics. Checked as far back as 2.022. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 01, 2009 [Issue 1253] array initializers as expressions are not allowed in const arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1253 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #6 from Don <clugdbug@yahoo.com.au> 2009-09-01 08:24:13 PDT --- And here's a patch. Cause: The initializer is used in declaration.c, VarDeclaration::semantic(). We see the lines: ------ Expression *e = init->toExpression(); if (!e) { init = init->semantic(sc, type); e = init->toExpression(); if (!e) ------ The initializer is supposed to return NULL if the initializer semantic hasn't been run yet. But the array initializer doesn't -- it prints an error, and returns an ErrorExp instead! It never has a chance. PATCH: init.c, last lines of ArrayInitializer::toExpression() (around line 473). Lno: delete elements; - error(loc, "array initializers as expressions are not allowed"); - return new ErrorExp(); + return NULL; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 06, 2009 [Issue 1253] array initializers as expressions are not allowed in const arrays | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=1253 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED --- Comment #7 from Walter Bright <bugzilla@digitalmars.com> 2009-10-06 02:19:51 PDT --- Fixed dmd 2.033 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation