View mode: basic / threaded / horizontal-split · Log in · Help
August 29, 2004
volatile and parametrized class bug
When I try to use a parametrized class containing a volatile statement I get
an error (at least on Linux - but I assume win32 should be the same). For
example

class Foo(Value) {
 void bar(Value u) {
   int x;
   volatile x = 10;
 }
}

int main() {
 Foo!(int) x = new Foo!(int);
 Foo!(Object) y = new Foo!(Object);
 return 0;
}

I get:

foo.d(2): function bar cannot access frame of function bar
foo.d(10): template instance Foo!(Object ) error instantiating

If I have just one template instance then it works fine. I need volatile
statements for my concurrent containers so right now they are
volatile-less, which seemed to cause problems on a dual-cpu machine I
started testing on.

-Ben
Top | Discussion index | About this forum | D home