digitalmars.D.bugs - [Issue 23416] New: Difference DMD/GDC: Error: non-constant
- d-bugmail puremagic.com (39/39) Oct 14 2022 https://issues.dlang.org/show_bug.cgi?id=23416
https://issues.dlang.org/show_bug.cgi?id=23416 Issue ID: 23416 Summary: Difference DMD/GDC: Error: non-constant expression `& foo` Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: kdevel vogtner.de ``` module dmd_gdc_difference; template funcptr (alias method) { immutable funcptr = &method; } struct S { void function () fun; void foo () { fun = funcptr!foo; } } unittest { S m; } ``` $ dmd -unittest -main dmd-gdc-difference.d dmd-gdc-difference.d(4): Error: non-constant expression `& foo` $ gdc -funittest -fmain dmd-gdc-difference.d -o dmd-gdc-difference $ ./dmd-gdc-difference 1 modules passed unittests Versions checked: GDC 12.1, 11.3; DMD v2.100.2, 2.080.0 Found in: https://forum.dlang.org/post/lnjjxiuzuqdjhaeiizhf forum.dlang.org (Generate a pointer to a method of a struct) --
Oct 14 2022