This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/37986] New: std::tr1::variate_generator does not conform to TR1.


I am assuming that section 5.1.3 of [1] is sufficiently close to the final TR1.
In paragraph 2, the draft allows U, U&, U* as the first template parameter of
variate_generator. However, the following minimal program:

-- 
#include <tr1/random>

int main(int argc, char **argv) {
  std::tr1::mt19937 mt;
  std::tr1::uniform_real<double> dist;

  std::tr1::variate_generator<
    std::tr1::mt19937,
    std::tr1::uniform_real<double>
    > g(mt, dist);
  std::tr1::variate_generator<
    std::tr1::mt19937&,
    std::tr1::uniform_real<double>
    > g(mt, dist);
  std::tr1::variate_generator<
    std::tr1::mt19937*,
    std::tr1::uniform_real<double>
    > g(&mt, dist);

  return 0;
}
-- 

Yields these error message:

-- 
/opt/local/include/gcc43/c++/tr1_impl/random: In instantiation of
'std::tr1::__detail::_Adaptor<std::tr1::mt19937&,
std::tr1::uniform_real<double> >':
/opt/local/include/gcc43/c++/tr1_impl/random:245:   instantiated from
'std::tr1::variate_generator<std::tr1::mt19937&, std::tr1::uniform_real<double>
>'
tr1_43.cpp:14:   instantiated from here
/opt/local/include/gcc43/c++/tr1_impl/random:82: error: 'std::tr1::mt19937&' is
not a class, struct, or union type
/opt/local/include/gcc43/c++/tr1_impl/random: In instantiation of
'std::tr1::__detail::_Adaptor<std::tr1::mt19937*,
std::tr1::uniform_real<double> >':
/opt/local/include/gcc43/c++/tr1_impl/random:245:   instantiated from
'std::tr1::variate_generator<std::tr1::mt19937*, std::tr1::uniform_real<double>
>'
tr1_43.cpp:18:   instantiated from here
/opt/local/include/gcc43/c++/tr1_impl/random:82: error: 'std::tr1::mt19937*' is
not a class, struct, or union type
-- 

I do not know if this is still the case with gcc 4.4.

[1] www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1836.pdf


-- 
           Summary: std::tr1::variate_generator does not conform to TR1.
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: holtgrewe at ira dot uka dot de


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]