D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7403 - Possible to instantiate forward referenced classes
Summary: Possible to instantiate forward referenced classes
Status: RESOLVED INVALID
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-30 17:28 UTC by Martin Nowak
Modified: 2012-01-31 01:19 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2012-01-30 17:28:33 UTC
class Forward;

void main()
{
    auto fwd = new Forward; // linker error
}

----

This should be detected at compile time.
Comment 1 Jacob Carlborg 2012-01-30 23:20:01 UTC
Isn't it possible to have the implementation in a different object file?
Comment 2 Walter Bright 2012-01-31 01:19:04 UTC
Jacob's right. This is not a bug. It's not conceptually different from calling a function marked as "extern".