[Issue 22775] The __traits does not see the scope attribute
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 15 08:00:09 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22775
--- Comment #2 from cbleser <cr at tagion.org> ---
I have detected a problem when using interfaces and scope variables.
It seems that the compile does not check the scope attributes.
The flowing compiles
```
struct S {
int x;
}
@safe
interface I {
int func(ref scope S s) @nogc;
}
@safe
class C : I {
int func(ref S s) {
return 2*s.x;
}
}
```
The problem is that the interface function has a (ref scope S) parameter but
the class implements a (ref S).
(The code should be compiled with dip25 and dip1000)
The biggest problem is that sometimes it results in a segmentation fault. Due
to that, the compiler seems to treats it as two different when it is called
from the interface.
Note. It seems that the @nogc is carried to the C.func. (Maybe it is just
auto-adapted)
See. The attached example.
Keep up the good work tanks.
--
More information about the Digitalmars-d-bugs
mailing list