[Issue 22192] Inconsistent attribute inference for template member function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 8 14:57:39 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=22192

--- Comment #2 from Eyal <eyal at weka.io> ---
If you change your second to:

struct S {
    ubyte x;
    align(1) int* p;
}

// @safe <-- will fail to build with this attribute, but it will infer as
@safe!
auto fun(int* p) {
    S s;
    s.p = p;
    return s;
}

// pure nothrow @nogc @safe S(int* p)
pragma(msg, typeof(fun));


i.e: make the ptr be at offset 1, misaligned - it will infer as @safe, but
refuse to type-check with @safe

--


More information about the Digitalmars-d-bugs mailing list