Thread overview | ||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 08, 2010 [Issue 4841] New: An array()/map inlining problem | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=4841 Summary: An array()/map inlining problem Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2010-09-08 04:08:00 PDT --- This is a D2 program: import std.algorithm: map; import std.array: array; void main() { int c; array(map!((x){return c;})([1])); } It works if you compile it with dmd 2.048 with: dmd test.d But if use inlining: dmd -inline test.d It doesn't compile and dmd returns: test.d(5): Error: function D main is a nested function and cannot be accessed from array I think this is a compiler bug because inlining should not affect the compilability of a program. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
September 10, 2010 [Issue 4841] -inline wrecks delegate literals as alias parameters (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |clugdbug@yahoo.com.au Summary|An array()/map inlining |-inline wrecks delegate |problem |literals as alias | |parameters (An array()/map | |inlining problem) --- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-09-10 00:02:24 PDT --- Original title: "An array()/map inlining problem" Here's a simpler case that gives the same error message, only with -inline: --- struct Struct4841(alias pred) { this(int k) { } } void bug4841a() { Struct4841!( (t) { any_old_garbage;} )( 1 ); } void bug4841b() { bug4841a(); } --- This is a problem with delegates and alias templates. It's not a regression. There also seems to be an accepts-invalid bug in this. You can put any old garbage inside the alias, which seems odd. And you cannot declare a variable of type Struct4841!( (t) { any_old_garbage;} ) --- it's rejected at the parsing stage. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 16, 2012 [Issue 4841] -inline wrecks delegate literals as alias parameters (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 Trass3r <mrmocool@gmx.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mrmocool@gmx.de --- Comment #2 from Trass3r <mrmocool@gmx.de> 2012-01-16 12:41:31 PST --- I think the following test case also belongs to this issue: R1 find(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) { return simpleMindedFind!pred(haystack, needle); } R1 simpleMindedFind(alias pred, R1, R2)(R1 haystack, R2 needle) { bool haystackTooShort() { return true; } return haystack; } sizediff_t indexOf(Char1, Char2)(const(Char1)[] s, const(Char2)sub) { const(Char1)[] balance = find!({})(s, sub); return -1; } string extStr; void main() { extStr.indexOf("bla"); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
January 24, 2012 [Issue 4841] -inline wrecks delegate literals as alias parameters (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 David Simcha <dsimcha@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dsimcha@yahoo.com --- Comment #3 from David Simcha <dsimcha@yahoo.com> 2012-01-24 13:41:43 PST --- *** Issue 4724 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: ------- |
January 27, 2012 [Issue 4841] -inline wrecks nested struct with alias template parameter (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 Don <clugdbug@yahoo.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |2.059 Summary|-inline wrecks delegate |-inline wrecks nested |literals as alias |struct with alias template |parameters (An array()/map |parameter (An array()/map |inlining problem) |inlining problem) --- Comment #4 from Don <clugdbug@yahoo.com.au> 2012-01-27 00:35:53 PST --- Further reduced shows neither constructor nor delegate is required. struct Struct4841(alias pred) { void unused_func(); } void bug4841a() { int w; Struct4841!( w ) m; } void bug4841b() { bug4841a(); } ---------------- The unused function is required only because it makes Struct4841 into a nested struct. I think it is because moving a templated nested struct changes its type - the enclosing function is part of the mangled name, or something like that. It can't trivially be moved around. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 05, 2012 [Issue 4841] -inline wrecks nested struct with alias template parameter (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 --- Comment #5 from github-bugzilla@puremagic.com 2012-02-05 12:34:31 PST --- Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/7766bbd9857ab5ad5b1d5ff0444cb7088823a793 fix Issue 4841 - -inline wrecks nested struct with alias template parameter (An array()/map inlining problem) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 05, 2012 [Issue 4841] -inline wrecks nested struct with alias template parameter (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |bugzilla@digitalmars.com Resolution| |FIXED -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 06, 2012 [Issue 4841] -inline wrecks nested struct with alias template parameter (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 David Simcha <dsimcha@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|FIXED | --- Comment #6 from David Simcha <dsimcha@yahoo.com> 2012-02-05 21:07:57 PST --- I just tested the fix that was merged recently. It only fixes some cases such as Don's and Tass3r's. Bearophile's case is still broken, as is the case I reported in Bug 4724. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 06, 2012 [Issue 4841] -inline wrecks nested struct with alias template parameter (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 --- Comment #7 from Walter Bright <bugzilla@digitalmars.com> 2012-02-05 22:08:20 PST --- I believe this is the same as bug 5939. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
February 06, 2012 [Issue 4841] -inline wrecks nested struct with alias template parameter (An array()/map inlining problem) | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=4841 --- Comment #8 from Don <clugdbug@yahoo.com.au> 2012-02-06 10:00:46 PST --- (In reply to comment #7) > I believe this is the same as bug 5939. I don't think bug 5939 involves -inline, but this one definitely does. Unless there are plans to make compiler changes are to fix bug 5939, the inliner shouldn't be making this transformation. -- 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