Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2007-12-15 07:52:17


John Maddock wrote:
> If you pass a pair of std::size_t's to std::min or std::max then:
>
> * You get no warning if the min/max<unsigned> templates haven't been
> instantiated yet.
> * A warning if some other code has already instantiated
> std::min/max<unsigned>.
>
> Truely weird and very annoying indeed !
>
Apparently the template is instantiated per truly different type, but it
carries the __w64 annotation of the first such type it is instantiated
with. In other words, if the first instantiation is min<unsigned>,
passing the "unsigned __w64" size_t causes the warning.
Makes me wonder, if the first instantiation is min<unsigned __w64>, does
assigning the return value of min(unsigned, unsigned) to unsigned cause
the warning, too?

In any case, definitely an MS bug. A very tricky one.

Sebastian Redl


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk