This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/25845] want optional warning for non-constant declarations that could be constant



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]