Hi,

$ cat try.cc
#include <iostream>

static void foo() {
    std::cout << "hello, world\n";
}

int main() {
    extern void foo();
    foo();
}

$ g++-4.1.0 -Wall try.cc
try.cc:3: warning: `void foo()' defined but not used
$ ./a.out
hello, world

foo() is clearly used there so why does g++ warn about it?


-- 
           Summary: spurious warning: function defined but not used
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rwxr-xr-x at gmx dot de
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28156

Reply via email to