[Bug lto/89358] [7/8/9 Regression] Combining -std=c++14 and -std=c++17 objects gives ODR warnings
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Feb 15 10:44:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89358
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Taking just this code:
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)
{
return less<int>()(i, j);
}
Compiling as C++14 and C++14 and comparing the -fdump-tree-original dumps I
see:
--- f.cc.003t.original.14 2019-02-15 10:43:10.841906030 +0000
+++ f.cc.003t.original.17 2019-02-15 10:43:15.442914718 +0000
@@ -10,5 +10,5 @@
;; enabled by -tree-original
-<<cleanup_point return <retval> = (int) less<int>::operator() (&TARGET_EXPR
<D.2458, {}>, (const int &) &i, (const int &) &j)>>;
+<<cleanup_point return <retval> = (int) less<int>::operator() (&TARGET_EXPR
<D.2229, {.D.2170={}}>, (const int &) &i, (const int &) &j)>>;
So the generated code is slightly different when using -std=c++17, would that
cause -Wodr to complain?
More information about the Gcc-bugs
mailing list