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: "trippels 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 21:26:03 +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 #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
For example:
% cat foo1.cpp
#include <memory>
namespace {
class A {
int i;
};
}
class G {
std::unique_ptr<A> foo() const;
};
std::unique_ptr<A> G::foo() const { return std::make_unique<A>(); }
% cat foo2.cpp
#include <memory>
namespace {
class A {
bool a;
};
}
class H {
std::unique_ptr<A> bar() const;
};
std::unique_ptr<A> H::bar() const { return std::make_unique<A>(); }
% g++ -flto -shared -std=c++14 foo1.cpp foo2.cpp
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:102:12: warning: type
âstruct _Head_baseâ violates one definition rule [-Wodr]
struct _Head_base<_Idx, _Head, false>
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:102:12: note: a
different type is defined in another translation unit
struct _Head_base<_Idx, _Head, false>
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:147:13: note: the first
difference of corresponding definitions is field â_M_head_implâ
_Head _M_head_impl;
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:147:13: note: a field of
same name but different type is defined in another translation unit
_Head _M_head_impl;
^
foo1.cpp:3:7: note: type âstruct Aâ defined in anonymous namespace can not
match type âstruct Aâ
class A {
^
foo2.cpp:3:7: note: the incompatible type defined in anonymous namespace in
another translation unit
class A {
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:180:12: warning: type
âstruct _Tuple_implâ violates one definition rule [-Wodr]
struct _Tuple_impl<_Idx, _Head, _Tail...>
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:180:12: note: a type
with different bases is defined in another translation unit
struct _Tuple_impl<_Idx, _Head, _Tail...>
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:596:11: warning: type
âstruct tupleâ violates one definition rule [-Wodr]
class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/tuple:596:11: note: a type
with different bases is defined in another translation unit
class tuple<_T1, _T2> : public _Tuple_impl<0, _T1, _T2>
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:129:11:
warning: type âstruct unique_ptrâ violates one definition rule [-Wodr]
class unique_ptr
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:129:11:
note: a different type is defined in another translation unit
class unique_ptr
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:147:57:
note: the first difference of corresponding definitions is field â_M_tâ
__tuple_type _M_t;
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:147:57:
note: a field of same name but different type is defined in another translation
unit
__tuple_type _M_t;
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:146:57:
note: type âstruct __tuple_typeâ should match type âstruct __tuple_typeâ that
itself violate one definition rule
typedef std::tuple<typename _Pointer::type, _Dp> __tuple_type;
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:146:57:
note: the incompatible type is defined here
typedef std::tuple<typename _Pointer::type, _Dp> __tuple_type;
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:151:41:
warning: type âstruct element_typeâ violates one definition rule [-Wodr]
typedef _Tp element_type;
^
/home/trippels/gcc_6/usr/local/include/c++/6.0.0/bits/unique_ptr.h:151:41:
note: a different type is defined in another translation unit
typedef _Tp element_type;
^
foo1.cpp:4:7: note: the first difference of corresponding definitions is field
âiâ
int i;
^
foo2.cpp:4:8: note: a field with different name is defined in another
translation unit
bool a;
^