This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67888] Compiling clang 3.7.0 results in is used but never defined
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Oct 2015 10:29:42 +0000
- Subject: [Bug c++/67888] Compiling clang 3.7.0 results in is used but never defined
- Auto-submitted: auto-generated
- References: <bug-67888-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67888
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-10-08
Known to work| |6.0
Ever confirmed|0 |1
Known to fail| |4.9.4, 5.2.0
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced:
namespace std {
template <class _Tp> struct remove_reference {typedef _Tp type;};
template <class _Tp> struct remove_reference<_Tp&> {typedef _Tp type;};
template <class _Tp> struct remove_reference<_Tp&&> {typedef _Tp type;};
template <class _Tp>
inline
_Tp&&
forward(typename std::remove_reference<_Tp>::type& __t) throw()
{
return static_cast<_Tp&&>(__t);
}
template <class _Tp>
inline
_Tp&&
forward(typename std::remove_reference<_Tp>::type&& __t) throw()
{
return static_cast<_Tp&&>(__t);
}
template<class _Fp> class function;
namespace __function
{
template<class _Fp> class __base;
template<class _Rp, class ..._ArgTypes>
class __base<_Rp(_ArgTypes...)>
{
public:
virtual _Rp operator()(_ArgTypes&& ...) = 0;
};
template<class _FD, class _Alloc, class _FB> class __func;
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
class __func<_Fp, _Alloc, _Rp(_ArgTypes...)>
: public __base<_Rp(_ArgTypes...)>
{
public:
virtual _Rp operator()(_ArgTypes&& ... __arg);
};
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
_Rp
__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
{
return {};
}
}
template<class _Rp, class ..._ArgTypes>
class function<_Rp(_ArgTypes...)>
{
typedef __function::__base<_Rp(_ArgTypes...)> __base;
__base* __f_;
public:
template<class _Fp>
function(_Fp);
_Rp operator()(_ArgTypes...) const;
};
template<class _Rp, class ..._ArgTypes>
template <class _Fp>
function<_Rp(_ArgTypes...)>::function(_Fp)
: __f_(0)
{
}
template<class _Rp, class ..._ArgTypes>
_Rp
function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
{
return (*__f_)(std::forward<_ArgTypes>(__arg)...);
}
}
void setVisible()
{
struct Visiting { };
std::function<void(Visiting)> VisitModule { [&](Visiting) { } };
VisitModule({});
}
Fails with 4.9 and 5.2:
mod.ii:34:17: error: â_Rp std::__function::__base<_Rp(_ArgTypes
...)>::operator()(_ArgTypes&& ...) [with _Rp = void; _ArgTypes =
{setVisible()::Visiting}]â, declared using local type âsetVisible()::Visitingâ,
is used but never defined [-fpermissive]
virtual _Rp operator()(_ArgTypes&& ...) = 0;
^
Compiles OK with trunk.