This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/17120] New: [3.5 regression] warning: suggest parentheses around assignment used as truth value
- From: "reichelt at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 20 Aug 2004 13:21:26 -0000
- Subject: [Bug libstdc++/17120] New: [3.5 regression] warning: suggest parentheses around assignment used as truth value
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This came up with Jason's recent fix for -Wparentheses (PR 17041).
Just compiling
=======================
#include<cmath>
=======================
with -Wall on mainline I get the following error message 3 times:
..../bits/cmath.tcc: In function `_Tp std::__cmath_power(_Tp, unsigned int)
[with _Tp = double]':
..../cmath:338: instantiated from `_Tp std::__pow_helper(_Tp, int) [with _Tp =
double]'
..../cmath:353: instantiated from here
..../bits/cmath.tcc:43: warning: suggest parentheses around assignment used as
truth value
The error message is justified, since in
gcc/libstdc++-v3/include/c_std/cmath.tcc we have:
template<typename _Tp>
inline _Tp
__cmath_power(_Tp __x, unsigned int __n)
{
_Tp __y = __n % 2 ? __x : 1;
while (__n >>= 1) // line 43
{
__x = __x * __x;
if (__n % 2)
__y = __y * __x;
}
return __y;
}
I'll prepare a patch soon.
--
Summary: [3.5 regression] warning: suggest parentheses around
assignment used as truth value
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: critical
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: reichelt at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17120