------- Comment #2 from bav dot 272304 at gmail dot com 2007-04-08 21:16 ------- Code example:
============================================================ #include <complex> template<typename T> class Wrapper { T x_; public: Wrapper () throw () : x_(0) {} Wrapper (const T& x) throw () : x_(x) {} Wrapper operator* (const Wrapper& x) const throw () { return Wrapper (x_*x.x_); } Wrapper operator/ (const Wrapper& x) const throw () { return Wrapper (x_/x.x_); } Wrapper operator+ (const Wrapper& x) const throw () { return Wrapper (x_+x.x_); } Wrapper operator- (const Wrapper& x) const throw () { return Wrapper (x_-x.x_); } Wrapper operator- () const throw () { return Wrapper (-x_); } ~Wrapper () throw () {} }; int main () { std::complex <Wrapper<double> > x (Wrapper<double>(2.0)); std::pow (x, 23); } ============================================================ OUTPUT: debian:/# g++ bug.cpp --pedantic --std=c++98 -Wall /usr/include/c++/3.3/bits/cmath.tcc: In function `_Tp std::__cmath_power(_Tp, unsigned int) [with _Tp = std::complex<Wrapper<double> >]': /usr/include/c++/3.3/cmath:477: instantiated from `_Tp std::__pow_helper(_Tp, int) [with _Tp = std::complex<Wrapper<double> >]' /usr/include/c++/3.3/complex:564: instantiated from `std::complex<_Tp> std::pow(const std::complex<_Tp>&, int) [with _Tp = Wrapper<double>]' bug.cpp:29: instantiated from here /usr/include/c++/3.3/bits/cmath.tcc:42: error: no match for ternary 'operator?:' in '((__n % 2) != 0) ? __x : 1' -- bav dot 272304 at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bav dot 272304 at gmail dot | |com Component|libstdc++ |c++ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31511