September 01 [Issue 24736] New: core.atomic is not work with struct that has template parameter list and function pointer (-preview=all) | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24736 Issue ID: 24736 Summary: core.atomic is not work with struct that has template parameter list and function pointer (-preview=all) Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: normal Priority: P1 Component: phobos Assignee: nobody@puremagic.com Reporter: rayerd.wiz@gmail.com import core.atomic; // Compile within -preview=all enum VARS_AFTER_FP = true; synchronized shared class A { static void proc() {} void fn(ARGS...)(ARGS args) { static struct S { static if (VARS_AFTER_FP) { void function() fp; ARGS vars; } else { ARGS vars; void function() fp; } } S s; s.fp.atomicStore(&proc); static foreach (i, e; args) { s.vars[i].atomicStore(e.atomicLoad()); } } } void main() { auto a = new A; a.fn(1); // OK a.fn(2, "str"); // Runtime error when VARS_AFTER_FP is false. a.fn("str", 3); // Runtime error when VARS_AFTER_FP is true. } -- |
Copyright © 1999-2021 by the D Language Foundation