https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37986
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Manuel Holtgrewe from comment #0) > std::tr1::variate_generator< > std::tr1::mt19937&, > std::tr1::uniform_real<double> > > g(mt, dist); This case is only fixed for -std=gnu++98 mode. With -std=c++98 there is no reference collapsing and the std::tr1::__detail::_Adaptor class template tries to form a reference to a reference. From a look at the code, it appears that our variate_generator is not conforming, because its engine_value_type is the adaptor class, not the Engine argument. I don't intend to fix this, I'm just noting it here for posterity.