[Issue 21165] Spurious @nogc error with delegate taking `immutable size_t`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Aug 16 10:42:29 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21165
ag0aep6g <ag0aep6g at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
CC| |ag0aep6g at gmail.com
--- Comment #1 from ag0aep6g <ag0aep6g at gmail.com> ---
(In reply to andy.pj.hanson from comment #0)
> f((int, immutable size_t) {
> int y = x;
> });
[...]
> * The delegate parameters are named, as in `f((int a, immutable size_t b) {`.
Note that the second parameter is actually already named in the non-working
version. It's called "size_t". What's missing is the type. By adding "b",
size_t gets recognized as the type as intended.
Slightly more reduced test case:
----
@nogc:
void main()
{
int x = 0;
f((int, b) {
int y = x;
});
}
void f(T)(scope void delegate(T, immutable int) @nogc cb) {}
----
Also happens with other qualifiers (const, shared) instead of immutable.
--
More information about the Digitalmars-d-bugs
mailing list