Thread overview | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
September 05, 2010 [Issue 4825] New: "Error: non-constant expression" and -inline | ||||
---|---|---|---|---|
| ||||
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 --- Comment #0 from nfxjfg@gmail.com 2010-09-05 15:42:44 PDT --- 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: ------- |
September 05, 2010 [Issue 4825] "Error: non-constant expression" with -inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4825 --- Comment #1 from nfxjfg@gmail.com 2010-09-05 15:46:57 PDT --- 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: ------- |
September 09, 2010 [Issue 4825] Regression(1.057, 2.040) "Error: non-constant expression" with -inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | 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 --- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-09-09 14:09:58 PDT --- 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: ------- |
September 27, 2010 [Issue 4825] Regression(1.057, 2.040) "Error: non-constant expression" with -inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4825 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |patch --- Comment #3 from Don <clugdbug@yahoo.com.au> 2010-09-27 13:26:04 PDT --- 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: ------- |
October 08, 2010 [Issue 4825] Regression(1.057, 2.040) "Error: non-constant expression" with -inline | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | 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 --- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2010-10-08 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: ------- |
Copyright © 1999-2021 by the D Language Foundation