digitalmars.D.bugs - [Issue 23738] New: A function accepting an alias of a type member
- d-bugmail puremagic.com (42/42) Feb 24 2023 https://issues.dlang.org/show_bug.cgi?id=23738
https://issues.dlang.org/show_bug.cgi?id=23738 Issue ID: 23738 Summary: A function accepting an alias of a type member requires static Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: diagnostic, rejects-valid Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: schveiguy gmail.com Consider the following complete file: ```d struct S { int t; } static void foo(alias F)() { } void bar(alias F)() { } void main() { foo!(S.t); bar!(S.t); // Error: need `this` for `bar` of type `pure nothrow nogc safe void()` } ``` The call to `foo` succeeds, whereas the call to `bar` fails. The `static` storage class for a function at module level should be a no-op, but somehow it's affecting compilation. I believe both should succeed (taking an alias to a member without actually using the member, e.g. for introspection, is valid), though it's also worth investigating why `static` affects this function. See relevant thread, apparently an unreported bug since 2013: https://forum.dlang.org/post/simvgcbylmisvdlilxev forum.dlang.org --
Feb 24 2023