On 3/5/18 9:01 AM, Nordlöw wrote:
On Monday, 5 March 2018 at 12:41:06 UTC, Steven Schveighoffer wrote:
pragma(inline, true)
C lazyDeleted() pure nothrow @trusted { return cast(C)((cast(size_t*)null) + 1); }

I still can't evaluate at compile-though...

         enum holeKeyOffset = 0x1;

         pragma(inline, true)
         static K holeKey() @trusted pure nothrow @nogc
         {
             return cast(K)((cast(size_t*)null) + holeKeyOffset);
         }

         enum _ = holeKey;

fails as

     Error: cannot perform pointer arithmetic on non-arrays at compile time

No, I mean you call holeKey at *runtime*. Inlined, it's just returning a constant, so it should reduce to a constant.

-Steve

Reply via email to