Consider this code:
#include #include int xx = 7; template void f1(T arg) { arg += xx; } template
reference_wrapper has operator = and a non explicit constructor, see documentation.
reference_wrapper
operator =
So, even if it is surprising, it is the normal behaviour:
f2 rebinds the local reference_wrapper to xx.
f2
xx