Bug 11265 – Segfault while calling instance method of class defined inside struct
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2013-10-14T17:22:00Z
Last change time
2013-10-15T12:43:00Z
Keywords
industry, pull, wrong-code
Assigned to
nobody
Creator
jcrapuchettes
Comments
Comment #0 by jcrapuchettes — 2013-10-14T17:22:51Z
Running with D 2.063.2 the following code compiles and runs without any problems. Using git checkout 4a2fabf, the code compiles, but segfaults when trav.empty() is called. Possible changes to the code that will allow it to run correctly are noted in the comments.
struct S
{
//works if the class is moved out of the struct
class InnerClass //works if final is added
{
S s; //works if removed
bool empty()
{
return true;
}
}
}
void main()
{
S.InnerClass trav = new S.InnerClass();
trav.empty();
}