This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/66180] [6 Regression] many -Wodr false positives when building LLVM with -flto
- From: "hubicka at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 19 May 2015 17:56:20 +0000
- Subject: [Bug lto/66180] [6 Regression] many -Wodr false positives when building LLVM with -flto
- Auto-submitted: auto-generated
- References: <bug-66180-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66180
--- Comment #4 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:96:12:
warning: type âstruct pairâ violates one definition rule [-Wodr]
struct pair
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:96:12: note: a
different type is defined in another translation unit
struct pair
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:102:11: note:
the first difference of corresponding definitions is field âsecondâ
_T2 second; /// @c second is a copy of the second object
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/stl_pair.h:102:11: note:
a field of same name but different type is defined in another translation unit
_T2 second; /// @c second is a copy of the second object
^
/home/trippels/llvm/tools/clang/utils/TableGen/ClangDiagnosticsEmitter.cpp:131:10:
note: type âstruct GroupInfoâ defined in anonymous namespace can not match type
âstruct GroupInfoâ
struct GroupInfo {
^
/home/trippels/llvm/tools/clang/utils/TableGen/ClangSACheckersEmitter.cpp:73:8:
note: the incompatible type defined in anonymous namespace in another
translation unit
struct GroupInfo {
^
This looks like a real LLVM bug. If you do
class bar {
anonymous_namespace_type foo;
}
then definin bar in non-anonymous namespace in more than one unit is ODR
violation (because the type of field FOO is different in each of units). I
think that it is what the warning is about: the instantiation is non-anonymous
of type _T2=GroupInfo that is anonymous.