July 29, 2010 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 Christian Kamm <kamm-removethis@incasoftware.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kamm-removethis@incasoftwar | |e.de --- Comment #10 from Christian Kamm <kamm-removethis@incasoftware.de> 2010-07-29 07:40:11 PDT --- The main problem from my point of view is that this fails: struct X { int[] a; } const cX = X([1,2]); void main() { assert(cX.a.ptr is cX.a.ptr); } Which is an issue very similar to bug 2526 . -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 01, 2010 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 --- Comment #11 from nfxjfg@gmail.com 2010-09-01 12:34:43 PDT --- Btw. this is a CTFE problem, and the first example is in D1. I don't know what the hell is with D2 and immutable and implicit dups, but to get the same behavior on D2, replace const with enum. The array should be on the *datsegment*, not somehow constructed on the fly. Not sure about the exact testcase in bug 2356, but it's definitely different from writing "int[3] x; x[] = [1,2,3];". -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
October 23, 2010 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 nfxjfg@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code --- Comment #12 from nfxjfg@gmail.com 2010-10-23 06:58:06 PDT --- I just noticed that the wrong-code keyword is gone. Sorry that's just bullshit. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 07, 2011 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 nfxjfg@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 07, 2011 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 Brad Roberts <braddr@puremagic.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |braddr@puremagic.com Resolution|WONTFIX | -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 02, 2012 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED CC| |yebblies@gmail.com Resolution| |DUPLICATE --- Comment #13 from yebblies <yebblies@gmail.com> 2012-02-02 15:32:18 EST --- *** This issue has been marked as a duplicate of issue 2526 *** -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 02, 2012 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|DUPLICATE | --- Comment #14 from Don <clugdbug@yahoo.com.au> 2012-02-02 06:16:18 PST --- This isn't the same as bug 2526, which is an accepts-invalid bug. This has nothing to do with templates. The glue layer needs to detect when a constant is being initialized with an array literal, and when that happens, change it into a value on the static data segment (ie, it needs to create an XXXinit initializer). Doing this would also help with bug 2356, but it isn't the same. (Bug 2356 will often need to create values at runtime, so it will need to copy data from the initializer). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
March 19, 2013 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 --- Comment #15 from Don <clugdbug@yahoo.com.au> 2013-03-19 04:51:15 PDT --- It passes if you specify the type in the const/enum. The reason is, that in declaration.c, VarDeclaration::semantic(), we see this code: else if (storage_class & (STCconst | STCimmutable | STCmanifest) || type->isConst() || type->isImmutable()) { /* Because we may need the results of a const declaration in a * subsequent type, such as an array dimension, before semantic2() * gets ordinarily run, try to run semantic2() now. * Ignore failure. */ if (!global.errors && !inferred) .... If we're inferring type inference, then semantic2 doesn't get run on the variable declaration (cX in the original bug report). So when it runs semantic on "return cx;", DsymbolExp::semantic() for cx, returns cx->init, which hasn't had semantic run on it yet. So it behaves like a copy-and-paste of the initializer. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
April 18, 2013 [Issue 4397] const/CTFE does not work | ||||
---|---|---|---|---|
| ||||
Posted in reply to nfxjfg@gmail.com | http://d.puremagic.com/issues/show_bug.cgi?id=4397 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |9953 --- Comment #16 from Don <clugdbug@yahoo.com.au> 2013-04-18 01:54:50 PDT --- There is no compiler bug here, it is working as designed, at least for D2. However, the design doesn't make sense. I have opened bug 9953 for the design change. It would be possible to give the desired behaviour in D1, though it's hardly worthwhile. In D2 I think it is a logical impossibility. IMHO this should just fail to compile. You should write "static const" instead of "enum" when you want to declare a constant of a reference type. -- 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