[Bug c++/51083] gnu++0x: resolving overloaded functions belonging to different namespaces
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 10 19:01:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51083
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paolo.carlini at oracle dot
| |com
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-10 18:46:24 UTC ---
Paolo, in <complex> this will match anything:
template<typename _Tp, bool = std::__is_integer<_Tp>::__value>
struct __promote
{ typedef double __type; };
template<typename _Tp>
struct __promote<_Tp, false>
{ typedef _Tp __type; };
template<typename _Tp>
inline typename __gnu_cxx::__promote<_Tp>::__type
imag(_Tp)
{ return _Tp(); }
Shouldn't it be restricted to *only* match long double, double, float and
integral types?
e.g. by changing the non-integer specialization
template<typename _Tp>
struct __promote<_Tp, false>
{ };
and adding explicit specialization
template<>
struct __promote<long double>
{ typedef long double __type; };
template<>
struct __promote<double>
{ typedef double __type; };
template<>
struct __promote<float>
{ typedef float __type; };
that allows the attached testcase to compile
More information about the Gcc-bugs
mailing list