[Bug lto/87905] structures in two different cpp source files with same name get flagged by ODR warning

2018-11-06 Thread shentino at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87905

--- Comment #4 from Raymond Jennings  ---
(In reply to Martin Liška from comment #2)
> > 
> > Note in the test package that neither struct is exposed to the other
> > translation unit.
> 
> But it's violation of C++ ODR and as LTO compilation unit is entire program,
> you then introduce violation.

I respectfully disagree.

Unless the source code itself changes, toggling LTO shouldn't affect generated
warnings.

It may be one /compilation/ unit, but by the standard they still count as
separate translation units.  LTO is an artifact of the compiler and not the
standard so it shouldn't have an impact on ODR warnings.

[Bug lto/87905] structures in two different cpp source files with same name get flagged by ODR warning

2018-11-06 Thread shentino at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87905

--- Comment #1 from Raymond Jennings  ---
just do g++ -flto *.cpp

[Bug lto/87905] New: structures in two different cpp source files with same name get flagged by ODR warning

2018-11-06 Thread shentino at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87905

Bug ID: 87905
   Summary: structures in two different cpp source files with same
name get flagged by ODR warning
   Product: gcc
   Version: lto
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: lto
  Assignee: unassigned at gcc dot gnu.org
  Reporter: shentino at gmail dot com
CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Created attachment 44964
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44964=edit
demonstrates the problem

This only happens when I enable -flto

Note in the test package that neither struct is exposed to the other
translation unit.