[Bug libstdc++/58302] New: compilation error : std::negative_binomial_distribution::operator(e, p)
faithandbrave at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Sep 3 03:42:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58302
Bug ID: 58302
Summary: compilation error :
std::negative_binomial_distribution::operator(e, p)
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: faithandbrave at gmail dot com
Follow code become compilation error:
#include <random>
int main()
{
typedef std::negative_binomial_distribution<> dist_type;
std::default_random_engine engine;
dist_type dist;
dist_type::param_type param(3, 0.5);
int result = dist(engine, param); // compile error!
}
error description:
prog.cc: In function 'int main()':
prog.cc:12:7: warning: unused variable 'result' [-Wunused-variable]
int result = dist(engine, param); // compile error!
^
In file included from /usr/local/gcc-head/include/c++/4.9.0/random:49:0,
from prog.cc:1:
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h: In instantiation of 'class
std::gamma_distribution<int>':
/usr/local/gcc-head/include/c++/4.9.0/bits/random.tcc:1295:4: required from
'std::negative_binomial_distribution<_IntType>::result_type
std::negative_binomial_distribution<_IntType>::operator()(_UniformRandomNumberGenerator&,
const std::negative_binomial_distribution<_IntType>::param_type&) [with
_UniformRandomNumberGenerator = std::linear_congruential_engine<long unsigned
int, 16807ul, 0ul, 2147483647ul>; _IntType = int;
std::negative_binomial_distribution<_IntType>::result_type = int]'
prog.cc:12:34: required from here
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h:2504:7: error: static
assertion failed: template argument not a floating point type
static_assert(std::is_floating_point<_RealType>::value,
^
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h: In instantiation of 'class
std::normal_distribution<int>':
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h:2699:45: required from
'class std::gamma_distribution<int>'
/usr/local/gcc-head/include/c++/4.9.0/bits/random.tcc:1295:4: required from
'std::negative_binomial_distribution<_IntType>::result_type
std::negative_binomial_distribution<_IntType>::operator()(_UniformRandomNumberGenerator&,
const std::negative_binomial_distribution<_IntType>::param_type&) [with
_UniformRandomNumberGenerator = std::linear_congruential_engine<long unsigned
int, 16807ul, 0ul, 2147483647ul>; _IntType = int;
std::negative_binomial_distribution<_IntType>::result_type = int]'
prog.cc:12:34: required from here
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h:2087:7: error: static
assertion failed: template argument not a floating point type
static_assert(std::is_floating_point<_RealType>::value,
^
In file included from /usr/local/gcc-head/include/c++/4.9.0/random:51:0,
from prog.cc:1:
/usr/local/gcc-head/include/c++/4.9.0/bits/random.tcc: In instantiation of
'std::negative_binomial_distribution<_IntType>::result_type
std::negative_binomial_distribution<_IntType>::operator()(_UniformRandomNumberGenerator&,
const std::negative_binomial_distribution<_IntType>::param_type&) [with
_UniformRandomNumberGenerator = std::linear_congruential_engine<long unsigned
int, 16807ul, 0ul, 2147483647ul>; _IntType = int;
std::negative_binomial_distribution<_IntType>::result_type = int]':
prog.cc:12:34: required from here
/usr/local/gcc-head/include/c++/4.9.0/bits/random.tcc:1298:64: error: no match
for call to '(std::gamma_distribution<double>)
(std::linear_congruential_engine<long unsigned int, 16807ul, 0ul,
2147483647ul>&, param_type)'
_M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
^
In file included from /usr/local/gcc-head/include/c++/4.9.0/random:49:0,
from prog.cc:1:
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h:2502:11: note: candidates
are:
class gamma_distribution
^
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h:2619:2: note:
template<class _UniformRandomNumberGenerator>
std::gamma_distribution<_RealType>::result_type
std::gamma_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&)
[with _UniformRandomNumberGenerator = _UniformRandomNumberGenerator; _RealType
= double]
operator()(_UniformRandomNumberGenerator& __urng)
^
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h:2619:2: note: template
argument deduction/substitution failed:
In file included from /usr/local/gcc-head/include/c++/4.9.0/random:51:0,
from prog.cc:1:
/usr/local/gcc-head/include/c++/4.9.0/bits/random.tcc:1298:64: note:
candidate expects 1 argument, 2 provided
_M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
^
In file included from /usr/local/gcc-head/include/c++/4.9.0/random:49:0,
from prog.cc:1:
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h:2624:2: note:
template<class _UniformRandomNumberGenerator>
std::gamma_distribution<_RealType>::result_type
std::gamma_distribution<_RealType>::operator()(_UniformRandomNumberGenerator&,
const std::gamma_distribution<_RealType>::param_type&) [with
_UniformRandomNumberGenerator = _UniformRandomNumberGenerator; _RealType =
double]
operator()(_UniformRandomNumberGenerator& __urng,
^
/usr/local/gcc-head/include/c++/4.9.0/bits/random.h:2624:2: note: template
argument deduction/substitution failed:
In file included from /usr/local/gcc-head/include/c++/4.9.0/random:51:0,
from prog.cc:1:
/usr/local/gcc-head/include/c++/4.9.0/bits/random.tcc:1298:64: note: cannot
convert 'std::gamma_distribution<int>::param_type((&
__p)->std::negative_binomial_distribution<_IntType>::param_type::k<int>(),
(int)(#'rdiv_expr' not supported by expression#))' (type 'param_type {aka
std::gamma_distribution<int>::param_type}') to type 'const
std::gamma_distribution<double>::param_type&'
_M_gd(__urng, param_type(__p.k(), (1.0 - __p.p()) / __p.p()));
More information about the Gcc-bugs
mailing list