Bug 10584 – Unhelpful error default constructing nested class
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-07-09T11:21:07Z
Last change time
2022-01-14T06:55:53Z
Keywords
bootcamp, diagnostic, pull
Assigned to
No Owner
Creator
Peter Alexander
Comments
Comment #0 by peter.alexander.au — 2013-07-09T11:21:07Z
class A
{
class B {}
B b = new B();
}
Error: 'this' is only defined in non-static member functions, not A.
This error isn't particularly helpful, since I don't explicitly request this. The error should state that constructing B requires a this reference, which isn't available for default construction.