[Bug c++/25845] want optional warning for non-constant declarations that could be constant
sigra at home dot se
gcc-bugzilla@gcc.gnu.org
Wed Jan 18 16:07:00 GMT 2006
------- Comment #2 from sigra at home dot se 2006-01-18 16:07 -------
Example 1:
{
int i = f();
do_something(i + 1, 7, 'h');
do_something_else(i % 3, 'e');
}
If i could be declared "const int", the compiler should warn.
Example 2:
float dra(float m, Panel & p) {
p.do_me(5);
return p.set_moad(m);
}
If m could be declared "const float", the compiler should warn.
Example 3:
{
char t = 2;
if (hej.is_double()) t *= 7;
std::cout << static_cast<unsigned short>(t) << std::endl;
}
If "static_cast<const unsigned short>" would work, the compiler should warn.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25845
More information about the Gcc-bugs
mailing list