1864 – Variable incorrectly declared final in final class template

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1864 - Variable incorrectly declared final in final class template
Summary: Variable incorrectly declared final in final class template
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: x86 Linux
: P2 normal
Assignee: Walter Bright
URL:
Keywords: rejects-valid
Depends on:
Blocks:
Reported: 2008年02月24日 03:09 UTC by Max Samukha
Modified: 2014年02月24日 15:31 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Max Samukha 2008年02月24日 03:09:18 UTC
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;
 } 
 }
}
----
Comment 1 Walter Bright 2008年03月07日 00:34:21 UTC
Fixed dmd 1.028


AltStyle によって変換されたページ (->オリジナル) /