digitalmars.D - Weird Compile Error
- John Demme (8/8) Feb 13 2005 OK... This error message has me totally confused:
- Chris Sauls (4/15) Feb 13 2005 Sounds like you're trying to do something strange with a function
- John Demme (43/61) Feb 13 2005 public nnWebNode[] getImmediateChildren()
- Chris Sauls (7/7) Feb 13 2005 Hmm... wow, now I'm confused. Don't see any use of func literals in
- John Demme (5/14) Feb 13 2005 No reason... I just changed it to see if it made any difference in
- Walter (3/3) Feb 14 2005 To implement the foreach, the compiler internally generates some functio...
- John Demme (35/40) Feb 15 2005 Commenting out the foreaches does nothing. What triggers it is using
- John Demme (30/79) Feb 15 2005 Walter,
- John Demme (10/21) Feb 13 2005 Alright.. I've got another clue, although I haven't been able to boil it...
- John Demme (5/32) Feb 13 2005 OK... I fixed the problem by modifying that line from:
- Chris Sauls (9/43) Feb 13 2005 Hmm. Odd.
- John Reimer (3/11) Feb 13 2005 Either it's a misdiagnosed error, or it's a valid error for something
- John Reimer (11/45) Feb 13 2005 Strange.
- John Demme (2/56) Feb 13 2005
OK... This error message has me totally confused: src/com/neuralnexus/nnengine/nodeweb.d(436): function com.neuralnexus.nnengine.nodeweb.nnWebNode.getImmediateChildren cannot access frame of function __funclit9 ???? I'm running DMD 0.113 on Linux. Thanks John
Feb 13 2005
Sounds like you're trying to do something strange with a function literal. Can you show the body of nnWebNode.getImmediateChildren ? -- Chris S John Demme wrote:OK... This error message has me totally confused: src/com/neuralnexus/nnengine/nodeweb.d(436): function com.neuralnexus.nnengine.nodeweb.nnWebNode.getImmediateChildren cannot access frame of function __funclit9 ???? I'm running DMD 0.113 on Linux. Thanks John
Feb 13 2005
public nnWebNode[] getImmediateChildren() { if (this == nodes.pcRel || this == nodes.cRel || this == nodes.pRel) { nnWebNode[] ret = linkedNodes.keys.dup; if (this == nodes.pcRel) { ret ~= nodes.cRel; ret ~= nodes.pRel; } } else { nnWebNode[] pcRels = getLinkedPCRelChildren(); nnWebNode[] pRels = getLinkedPRelChildren(); nnWebNode[] gpcRels; foreach(nnWebNode pcRel; pcRels) foreach(nnWebNode pRel; pRels) if (pcRel.isLinkedTo(pRel)) gpcRels ~= pcRel; nnWebNode[] ret; foreach(nnWebNode pcRel; gpcRels) { nnWebNode[] cRels = pcRel.getLinkedCRelChildren(); foreach(nnWebNode cRel; cRels) foreach(nnWebNode lNode; cRel.getLinkedNodes()) if (pcRel.isLinkedTo(lNode)) ret ~= lNode; } if (this == nodes.Rel) ret ~= nodes.pcRel; return ret; } } I was going to post it originally, but it's a pretty mundane function. Also of note is that this compiled no problem with previous versions of DMD. I haven't touched the code in awhile, so I'm not sure when it stopped working. John Chris Sauls wrote:Sounds like you're trying to do something strange with a function literal. Can you show the body of nnWebNode.getImmediateChildren ? -- Chris S John Demme wrote:OK... This error message has me totally confused: src/com/neuralnexus/nnengine/nodeweb.d(436): function com.neuralnexus.nnengine.nodeweb.nnWebNode.getImmediateChildren cannot access frame of function __funclit9 ???? I'm running DMD 0.113 on Linux. Thanks John
Feb 13 2005
Hmm... wow, now I'm confused. Don't see any use of func literals in there at all. Suddenly I see why you asked about it on the newsgroup. And is there a special reason (just something I noted when scanning it and mentally compiling) why 'nnWebNode[] ret' is defined seperately in the if and else blocks? -- Chris S
Feb 13 2005
Chris Sauls wrote:Hmm... wow, now I'm confused. Don't see any use of func literals in there at all. Suddenly I see why you asked about it on the newsgroup.436 is the first line- the function declaration.And is there a special reason (just something I noted when scanning it and mentally compiling) why 'nnWebNode[] ret' is defined seperately in the if and else blocks? -- Chris SNo reason... I just changed it to see if it made any difference in compilation... it didn't. John
Feb 13 2005
To implement the foreach, the compiler internally generates some function literals. Is it possible for you to try whacking out bits of this function to see what the minimum that triggers the error is?
Feb 14 2005
Commenting out the foreaches does nothing. What triggers it is using nodes. This is also what's triggering my "Weird Linking Error". With: public struct Nodes { nnWebNode Root; nnWebNode Null; nnWebNode String; nnWebNode Name; nnWebNode[nnNodeID] nodes; void init() {// Stuff } } And: public Nodes nodes; I get the compiler error in any function that does something like: public nnWebNode[] getImmediateChildren() { nnWebNode[] ret; if (this == nodes.Null) {} } And it likes that function if I change it to not use nodes.Null. It'll also compile if I change the: public Nodes nodes; line to: public static Nodes nodes; However, when I change that line, I get the weird linking issues that I've detailed in that post, as if the static keyword works like it does in C when it's used in the module scope. Is this two seperate bugs, both out to screw with my head, or two symptoms of the same problem? John Walter wrote:To implement the foreach, the compiler internally generates some function literals. Is it possible for you to try whacking out bits of this function to see what the minimum that triggers the error is?
Feb 15 2005
Walter, I've got a test case for it all. With the first line commented out, it doesn't compile. With the second line commented out, and the first uncommented, it compiles but doesn't work. I can't get around this one. TIA, John ------------------------------ module test2; //public static Nodes nodes; public Nodes nodes; public struct Nodes { Object Null; Object Name; void init(){} } class A { public int b() { return (this == nodes.Null); } } -------------------------------------- module test3; import test2; void main() { nodes.init(); A a = new A(); a.b(); } ------------------------------------- John Demme wrote:Commenting out the foreaches does nothing. What triggers it is using nodes. This is also what's triggering my "Weird Linking Error". With: public struct Nodes { nnWebNode Root; nnWebNode Null; nnWebNode String; nnWebNode Name; nnWebNode[nnNodeID] nodes; void init() {// Stuff } } And: public Nodes nodes; I get the compiler error in any function that does something like: public nnWebNode[] getImmediateChildren() { nnWebNode[] ret; if (this == nodes.Null) {} } And it likes that function if I change it to not use nodes.Null. It'll also compile if I change the: public Nodes nodes; line to: public static Nodes nodes; However, when I change that line, I get the weird linking issues that I've detailed in that post, as if the static keyword works like it does in C when it's used in the module scope. Is this two seperate bugs, both out to screw with my head, or two symptoms of the same problem? John Walter wrote:To implement the foreach, the compiler internally generates some function literals. Is it possible for you to try whacking out bits of this function to see what the minimum that triggers the error is?
Feb 15 2005
Alright.. I've got another clue, although I haven't been able to boil it down to a short test case. I've got a struct, called "Nodes" and then, first thing in the module, I've got: Nodes nodes; To create a global instance of the struct. Any function that uses this struct seems to fail on this error. Any suggestions? Please? John John Demme wrote:OK... This error message has me totally confused: src/com/neuralnexus/nnengine/nodeweb.d(436): function com.neuralnexus.nnengine.nodeweb.nnWebNode.getImmediateChildren cannot access frame of function __funclit9 ???? I'm running DMD 0.113 on Linux. Thanks John
Feb 13 2005
OK... I fixed the problem by modifying that line from: public Node nodes; to public static Node nodes; John Demme wrote:Alright.. I've got another clue, although I haven't been able to boil it down to a short test case. I've got a struct, called "Nodes" and then, first thing in the module, I've got: Nodes nodes; To create a global instance of the struct. Any function that uses this struct seems to fail on this error. Any suggestions? Please? John John Demme wrote:OK... This error message has me totally confused: src/com/neuralnexus/nnengine/nodeweb.d(436): function com.neuralnexus.nnengine.nodeweb.nnWebNode.getImmediateChildren cannot access frame of function __funclit9 ???? I'm running DMD 0.113 on Linux. Thanks John
Feb 13 2005
Hmm. Odd. A) I wouldn't think that would have to be static... but oh well, that shouldn't hurt it any at all. B) The error message sure didn't give /any/ clues at all. Obviously, considering my initial intuitive response was, "Oh, something wrong with a function literal?" I think maybe the compiler misdiagnosed. Bug. -- Chris S John Demme wrote:OK... I fixed the problem by modifying that line from: public Node nodes; to public static Node nodes; John Demme wrote:Alright.. I've got another clue, although I haven't been able to boil it down to a short test case. I've got a struct, called "Nodes" and then, first thing in the module, I've got: Nodes nodes; To create a global instance of the struct. Any function that uses this struct seems to fail on this error. Any suggestions? Please? John John Demme wrote:OK... This error message has me totally confused: src/com/neuralnexus/nnengine/nodeweb.d(436): function com.neuralnexus.nnengine.nodeweb.nnWebNode.getImmediateChildren cannot access frame of function __funclit9 ???? I'm running DMD 0.113 on Linux. Thanks John
Feb 13 2005
Chris Sauls wrote:Hmm. Odd. A) I wouldn't think that would have to be static... but oh well, that shouldn't hurt it any at all. B) The error message sure didn't give /any/ clues at all. Obviously, considering my initial intuitive response was, "Oh, something wrong with a function literal?" I think maybe the compiler misdiagnosed. Bug.Either it's a misdiagnosed error, or it's a valid error for something the compiler is doing behind the scenes.
Feb 13 2005
Strange. I wonder why the non-static version causes the "funclit" error. As for the Node struct, perhaps, without the static designation, it can't be accessed properly outside of its module; the d manual states: "Static data has only one instance for the entire program, not once per object." So what does this imply for non-static module level instances of a struct? Is access to them limited to the module only? It would be nice to know a few more nitty gritty details here about how the compiler works. -John R. John Demme wrote:OK... I fixed the problem by modifying that line from: public Node nodes; to public static Node nodes; John Demme wrote:Alright.. I've got another clue, although I haven't been able to boil it down to a short test case. I've got a struct, called "Nodes" and then, first thing in the module, I've got: Nodes nodes; To create a global instance of the struct. Any function that uses this struct seems to fail on this error. Any suggestions? Please? John John Demme wrote:OK... This error message has me totally confused: src/com/neuralnexus/nnengine/nodeweb.d(436): function com.neuralnexus.nnengine.nodeweb.nnWebNode.getImmediateChildren cannot access frame of function __funclit9 ???? I'm running DMD 0.113 on Linux. Thanks John
Feb 13 2005
John Reimer wrote:Strange. I wonder why the non-static version causes the "funclit" error. As for the Node struct, perhaps, without the static designation, it can't be accessed properly outside of its module; the d manual states:Actually, this was all inside the same module."Static data has only one instance for the entire program, not once per object." So what does this imply for non-static module level instances of a struct? Is access to them limited to the module only? It would be nice to know a few more nitty gritty details here about how the compiler works. -John R. John Demme wrote:OK... I fixed the problem by modifying that line from: public Node nodes; to public static Node nodes; John Demme wrote:Alright.. I've got another clue, although I haven't been able to boil it down to a short test case. I've got a struct, called "Nodes" and then, first thing in the module, I've got: Nodes nodes; To create a global instance of the struct. Any function that uses this struct seems to fail on this error. Any suggestions? Please? John John Demme wrote:OK... This error message has me totally confused: src/com/neuralnexus/nnengine/nodeweb.d(436): function com.neuralnexus.nnengine.nodeweb.nnWebNode.getImmediateChildren cannot access frame of function __funclit9 ???? I'm running DMD 0.113 on Linux. Thanks John
Feb 13 2005