I have a lot of cases where it would be possible (more or less trivial, depending on the situation/code) to check if an assert() would fail at compile time. In such cases, I would want that GCC gives a warning (or an error).
I understand that it's not possible to catch all cases but on such cases where it is easy for GCC to do such a check, I would like that GCC does it and reports it if it would fail. For the warning itself: The warning should point out the line where the problem is really caused (or all lines which could cause that problem). E.g., if I have an inline function where the assert depends on the function argument, I would like to get the line-nr where I call that function, not the line-nr of the assert() itself. (Just to avoid confusion: I am aware of static asserts but these are different things and not an option in most cases where I use assert(). Also, I don't want to make things harder for myself to figure out always when I can use an static assert and when not. And anyway, there are still a lot of trivial cases where a static assert is not possible but it would be still trivial for the compiler to see that it would fail.) -- Summary: check assert() at compile time if possible Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ich at az2000 dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39462