digitalmars.D.bugs - [Issue 4825] New: "Error: non-constant expression" and -inline
- d-bugmail puremagic.com (33/33) Sep 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4825
- d-bugmail puremagic.com (8/8) Sep 05 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4825
- d-bugmail puremagic.com (15/15) Sep 09 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4825
- d-bugmail puremagic.com (30/30) Sep 27 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4825
- d-bugmail puremagic.com (12/12) Oct 08 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4825
http://d.puremagic.com/issues/show_bug.cgi?id=4825 Summary: "Error: non-constant expression" and -inline Product: D Version: D1 Platform: Other OS/Version: All Status: NEW Keywords: rejects-valid Severity: regression Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: nfxjfg gmail.com This only happens with -inline. It worked on dmd 1.055, but fails on dmd 1.057, 1.061, 1.062 and 1.063. //fails with dmd -c -inline test.d int a() { int r; return r; //Error: non-constant expression r } int b() { return a(); } void c() { void d() { auto e = b(); } const int f = b(); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4825 I have to add that this bug triggers even when the "const int..." line on function c is in a different function in a different module. This makes it a very non-obvious bug, where you have no idea what is happening. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 05 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4825 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug yahoo.com.au Version|D1 |D1 & D2 Summary|"Error: non-constant |Regression(1.057, 2.040) |expression" with -inline |"Error: non-constant | |expression" with -inline Replace 'const' with 'static const' and this fails on D2.040 and later, but passed on 2.039 and earlier. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 09 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4825 Don <clugdbug yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch This was caused by the improvements to CommaExp::interpret, making things like (int x=3, x); into an lvalue, which allows struct constructors to work in CTFE. But inlining can also create peculiar comma expressions. We need to make sure that non-ref returns return rvalues, not lvalues. PATCH interpret.c, ReturnStatement::interpret(), line 566. --- old ---- #if LOG Expression *e = exp->interpret(istate); printf("e = %p\n", e); return e; #else return exp->interpret(istate); #endif --- new --- Expression *e = exp->interpret(istate); if (e == EXP_CANT_INTERPRET) return e; // Convert lvalues into rvalues if (e->op == TOKvar) e = e->interpret(istate); return e; -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Sep 27 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4825 Walter Bright <bugzilla digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla digitalmars.com Resolution| |FIXED 13:11:12 PDT --- http://www.dsource.org/projects/dmd/changeset/708 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Oct 08 2010