Cannot swap a std.typecons.Tuple (original) (raw)

nick (@ntrel) reported this on 2023-12-18T11:42:39Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=24285

Description

enum x = (){ import std.algorithm, std.typecons; Tuple!int a, b; swap(a, b); return 0; }();

/usr/include/dmd/phobos/std/algorithm/mutation.d(2836): Error: reinterpreting cast from Tuple!int* to ubyte* is not supported in CTFE

First reported here: https://issues.dlang.org/show_bug.cgi?id=21429#c2

This also applies for any struct T that satisfies isBlitAssignable yet hasElaborateAssign!T || !isAssignable!T is true.

PR incoming.