Bug 1864 – Variable incorrectly declared final in final class template
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Linux
Creation time
2008-02-24T03:09:00Z
Last change time
2014-02-24T15:31:05Z
Keywords
rejects-valid
Assigned to
bugzilla
Creator
samukha
Comments
Comment #0 by samukha — 2008-02-24T03:09:18Z
Fails to compile with: Error: cannot modify final variable 'baz'.
----
final class Foo()
{
void bar()
{
int baz;
baz = 1;
}
}
void main()
{
auto foo = new Foo!();
}
----
The workaround is to define the template in full:
----
template Foo()
{
final class Foo
{
void bar()
{
int baz;
baz = 1;
}
}
}
----