This doesn't error out:

#include <stdio.h>
static inline int foo(void) {     return 1; }
static inline int foo(void) {     return 0; }
static inline int bar(void) {     return foo(); }
int main(void)
{
    if (bar())
      printf("1\n");
    else
      printf("0\n");

    return 0;
}

It appears to be a problem with inlining since if the inline keyword is removed
it works (well, fails) as expected.

-- 
           Summary: redefinition of inline function succeeds
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: echristo at redhat dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to