[Bug c++/51884] lamba with templates

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jan 18 03:23:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51884

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
            Summary|ICE with c++11 thread and   |lamba with templates
                   |templates                   |

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-01-18 01:01:11 UTC ---
Reduced testcase as far as I can do it, any more it does not ICE:
template<typename _Tp>     struct is_same { static const int value = 0; };
template<int> struct enable_if {
  typedef void type;
};
template<typename _Tp> class shared_ptr {};
struct thread   {
  struct _Impl_base     {
    virtual void _M_run() = 0;
  };
  template<typename _Callable> 
   struct _Impl : _Impl_base  {  };
  template<typename _Callable>  
   thread(_Callable&& __f) {
     _M_start_thread(_M_make_routine( __f));
   }
  template<typename _Callable> 
    shared_ptr<_Impl<_Callable>> _M_make_routine(_Callable&& __f);
};
template <typename T, typename = void> struct foo {};
template <typename T> struct foo<T,typename enable_if<is_same<T>::value>::type>
{
  template <bool Bar>  void bar() const  {
    auto f = [](){};
    thread thr(f);
  }
};
int main() {
 foo<int> f;
 f.bar<true>();
}
--- CUT ---
Note the original testcase had a _M_start_thread defined but this does not.



More information about the Gcc-bugs mailing list