10929 – [3.3/3.4 regression] -Winline warns about functions for which no definition is visible (original) (raw)
g++-3.3 -Winline generates warnings for functions it cannot inline that it shouldn't even try to inline because they are neither declared as "inline", nor defined in the class body.
Save the following as "main.cpp" /* snip / #include "foo.hpp" int main(int,char) { return foo(); } / snip / Save the following as "foo.hpp" / snip / int foo(void); / snip / Save the following as "foo.cpp" / snip / int foo(void) { return 0; } / snip */ Then compile with
$ g++-3.3 -O3 -Winline main.cpp new.cpp
Result is a useless warning that int foo(void) could not be inlined. (Correct, but supposed not to be inline-able).
Comment 1 Wolfgang Bangerth 2003-05-22 14:33:19 UTC
Confirmed. A profoundly unhelpful feature. It triggers on this simple code:
int foo(void);
int main() { return foo(); }
3.3 and 3.4 warn like this:
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc -O3 -Winline -c
x.cc: In function int main()': x.cc:1: warning: inlining failed in call to int foo()'
x.cc:4: warning: called from here
Warning about functions for which no definition is visible doesn't make much sense.
W.
Comment 2 Drea Pinski 2003-06-16 17:59:04 UTC
Who ever fixes this, please check if bug 11067 is fixed too, it looks like the same problem but a different test case.
Comment 5 Jason Merrill 2003-06-17 23:02:40 UTC
Fixed for 3.3.1.