D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1426 - const(templated class) allows calling mutable methods
Summary: const(templated class) allows calling mutable methods
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks: 2573
  Show dependency treegraph
 
Reported: 2007-08-17 08:57 UTC by Daniel
Modified: 2015-06-09 01:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Daniel 2007-08-17 08:57:29 UTC
class Foo(T) {
	void bar() {}
}

const(Foo!(int)) foo = new Foo!(int)();
foo.bar();

It's working, but it should fail with:
Error: foo.bar can only be called on a mutable object
Comment 1 Steven Schveighoffer 2010-03-16 20:08:30 UTC
Unsure of the version this was fixed, but it works as of 2.041.