[Bug c++/31511] New: /usr/include/c++/bits/cmath.tcc: no match for ternary 'operator?:' in '((__n % 2u) != 0u) ? __x : 1'
bav dot 272304 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Apr 8 20:03:00 GMT 2007
It is known problem with GNU ISO C++ Library math implementation by Gabriel Dos
Reis.
g++ compiler says something like this:
/usr/include/c++/bits/cmath.tcc:41: error: no match for
ternary 'operator?:' in '((__n % 2u) != 0u) ? __x : 1'
It could be fixed by replacing the certain line at the cmath.tcc file
_Tp __y = __n % 2 ? __x : 1;
with more correct
_Tp __y = __n % 2 ? __x : _Tp(1);
(see cmath.tcc for details)
To reproduce error, try to pass to std::pow() std::complex<T> object where T
isn't primitive type but some class with arithmetic operators overloaded.
I found it in g++ 3.3.5, g++ 4.0.0, etc.
--
Summary: /usr/include/c++/bits/cmath.tcc: no match for ternary
'operator?:' in '((__n % 2u) != 0u) ? __x : 1'
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bav dot 272304 at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31511
More information about the Gcc-bugs
mailing list