https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68658

            Bug ID: 68658
           Summary: [6 Regression] LTO - bogus redefinition of warning
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
  Target Milestone: ---

I have the following three-file program. Compiling it without LTO or with GCC 5
works, but with GCC 6 + LTO, I get:

g++ -O2 -flto one.cc two.cc
one.cc:3:5: error: redefinition of ‘int one::func()’
 int one::func() { return 1;}
     ^~~

one.h:3:15: note: ‘virtual int one::func()’ previously defined here
   virtual int func();
               ^~~~

one.cc: In function ‘int bar(one)’:
one.cc:5:5: error: redefinition of ‘int bar(one)’
 int bar(class one y) {
     ^~~

one.h:6:5: note: ‘int bar(one)’ previously defined here
 int bar(class one y);
     ^~~



==> one.h <==
class one {
 public:
  virtual int func();
};

int bar(class one y);

==> one.cc <==
#include "one.h"

int one::func() { return 1;}

int bar(class one y) {
  return y.func();
}

==> two.cc <==
#include "one.h"

int main() {
  class one x;
  return bar(x);
}

Reply via email to