https://issues.dlang.org/show_bug.cgi?id=13781
Kenji Hara <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|DMD |Phobos Hardware|x86 |All OS|Windows |All --- Comment #2 from Kenji Hara <[email protected]> --- (In reply to Peter Alexander from comment #1) > Adding @nogc to Tuple.opAssign gives: > > Error: @nogc function 'std.typecons.Tuple!(string, > "s").Tuple.opAssign!(Tuple!(string, "s")).opAssign' cannot call non-@nogc > function 'std.algorithm.swap!(Tuple!string).swap' > > Adding @nogc to swap makes the code compile. > > Both are templates, so @nogc should be inferred. Marking this as a DMD bug. This is a little problem in Phobos code. 'swap' is used from the opAssign template function in Tuple, but swap checks (hasElaborateAssign!T || !isAssignable!T) and it would see the signature of T.opAssign. On mutual function calls, attributes are inferred as non-@nogc by default. It's a design so this is not a compiler bug. The correct fix is to mark std.algorithm.swap function as @nogc. --
