https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89358
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This shows it has nothing to do with r243379 at all:
template<typename _Arg1, typename _Arg2, typename _Result>
struct binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template<typename _Tp>
struct less : public binary_function<_Tp, _Tp, bool>
{
constexpr
bool
operator()(const _Tp& __x, const _Tp& __y) const
{ return __x < __y; }
};
int f(int i, int j);
#if __cplusplus < 201703L
int f(int i, int j)
{
return less<int>()(i, j);
}
#else
int main()
{
return less<int>()(3, 4) == f(2, 1);
}
#endif
g++ -flto -c src.cc
g++ -flto -c src.cc -std=c++17 -o src17.o
g++ -flto src.o src17.o
src.cc:10:10: warning: type ‘struct less’ violates the C++ One Definition Rule
[-Wodr]
struct less : public binary_function<_Tp, _Tp, bool>
^
src.cc:10:10: note: a type with different bases is defined in another
translation unit
struct less : public binary_function<_Tp, _Tp, bool>
^
src.cc:14:5: warning: ‘operator()’ violates the C++ One Definition Rule
[-Wodr]
operator()(const _Tp& __x, const _Tp& __y) const
^
src.cc:14:5: note: ‘operator()’ was previously declared here
operator()(const _Tp& __x, const _Tp& __y) const
^
This shows the exact same source code, compiled with -std=c++14 and -std=c++17,
and bogus warnings about different bases.