[Bug c++/86491] bogus and unsuppressible warning: 'YYY' has a base 'ZZZ' whose type uses the anonymous namespace
jason.vas.dias at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 11 19:51:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86491
--- Comment #3 from Jason Vas Dias <jason.vas.dias at gmail dot com> ---
Of course, these lines of t2.h from Comment #1 :
<quote>
template < class _C_, _C_ *_C_OBJ_, void (_C_::*_M_)() >
class NT
{ static constexpr _C_ *c_ = _C_OBJ_;
public:
NT()
{ (c_->*_M_)();
</quote>
could be replaced by:
<quote>
template < class _C_, _C_ *_C_OBJ_, void (_C_::*_M_)() >
class NT
{ static constexpr _C_ *c_ = _C_OBJ_;
public:
NT()
{ (c_->*_M_)();
</quote>
and the same problem would occur (-Wsubobject-linkage warning) .
(the existence of the 'c_' static const copy of '_C_' is irrelevant.
It is simply that any occurrence of, in file A:
namespace N {
template <class C, C *, (retval (C::*M())()>
class T { ... /* something that uses C */}
}
and in file B :
namespace N {
namespace X {
class Y { ... };
Y y;
}
class C : T< Y, &y, retval (&Y::a_Y_method) (,..) >
{...};
} // end namespace N
will trigger this bug.
I am trying to figure out why, and how it can be avoided.
I do not want to trigger C++'s special 'anonymous namespace object'
processing in any way here, and I do not see why it is being triggered.
More information about the Gcc-bugs
mailing list