digitalmars.D.bugs - [Issue 2485] New: non-static initialization of struct using static initializer syntax generates wrong code
- d-bugmail puremagic.com (35/35) Dec 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=2485
- d-bugmail puremagic.com (10/10) Oct 07 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2485
- d-bugmail puremagic.com (11/11) Jan 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=2485
http://d.puremagic.com/issues/show_bug.cgi?id=2485
Summary: non-static initialization of struct using static
initializer syntax generates wrong code
Product: D
Version: 1.035
Platform: PC
OS/Version: Linux
Status: NEW
Keywords: wrong-code
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: tomas famolsen.dk
The example from the spec added to document that static struct initializer
syntax is allowed for non-static initialization doesn't do what it's supposed
to with DMD.
I've produced a test case from it:
struct S {
int a; int b; int c; int d = 7;
}
void test(int i) {
S s = { 1, i }; // q.a = 1, q.b = i, q.c = 0, q.d = 7
assert(s.a == 1);
assert(s.b == i);
assert(s.c == 0); // line 8
assert(s.d == 7);
}
void main() {
test(42);
}
$ dmd foo.d
$ ./foo
Error: AssertError Failure foo.d(8)
--
Dec 02 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2485
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich gmail.com
*** Issue 4552 has been marked as a duplicate of this issue. ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 07 2010
http://d.puremagic.com/issues/show_bug.cgi?id=2485
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WORKSFORME
Works now, I think it was the same as bug 2850.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 16 2013









d-bugmail puremagic.com 