The code attached does not compile since version 4.0 of gcc.
Remove either the Cpu namespace or one element in the enumeration or replace
the array size in RGBPixel by a constant and the bug disappears.
It looks as if g++ ignores the overload for ChangeEndianness(RGB<T>&) when it
calls it from ChangeEndianness(T* begin,const T* end) so that the generic
version ChangeEndianness(T& t) is called instead generating and error because
the default class for SwapEndianness does not contain any swap method.
This has been tested with gcc version 4.2.0 20051206 (experimental).
Note also that things slightly improved since
gcc version 4.2.0 20051124 (experimental)
which failed also if the enumeration only had two elements (instead of three
now).
All this is a regression since gcc-3.4.
--
Summary: g++ seems to ignore an overloaded function.
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: theodore dot papadopoulo at sophia dot inria dot fr
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25278