https://issues.dlang.org/show_bug.cgi?id=18694
Issue ID: 18694 Summary: pure functions using static/global structs with no fields should pass compilation Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: and...@erdani.com Consider: struct S { enum int x = 42; } static S dummy; pure int fun(int x) { return dummy.x + x; } This code fails to compile: Error: pure function onlineapp.fun cannot access mutable static data dummy However, there is no mutable data to talk about in the first place so the code should pass compilation. The technique of using static data for a zero-sized struct is frequently used in the allocator framework. --