https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62256

            Bug ID: 62256
           Summary: /usr/include/c++/4.8/tr1/random.tcc:792:2: error: no
                    matching function for call to 'min'
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: wangn at ca dot ibm.com

use g++ to compile perennial test case TR19768/P95252.scenario fails. seems
related to header file.

source code:
$ cat t.cpp
#include <tr1/random>

typedef std::tr1::xor_combine< std::tr1::subtract_with_carry<short, 24, 10,
16>, 8, std::tr1::subtract_with_carry<short, 48, 10, 24>, 2 > type01;

/*--------------------------------------------------------------------*/
int main(void)
{
    type01 cl01;
    return 0;
}


how to reproduce:

g++ -c t.cpp

actual output:

In file included from /usr/include/c++/4.8/tr1/random:48:0,
                 from t.cpp:1:
/usr/include/c++/4.8/tr1/random.tcc: In instantiation of âvoid
std::tr1::xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>::_M_initialize_max() [with
_UniformRandomNumberGenerator1 = std::tr1::subtract_with_carry<short int, 24,
10, 16>; int __s1 = 8; _UniformRandomNumberGenerator2 =
std::tr1::subtract_with_carry<short int, 48, 10, 24>; int __s2 = 2]â:
/usr/include/c++/4.8/tr1/random.h:1324:27:   required from
âstd::tr1::xor_combine<_UniformRandomNumberGenerator1, __s1,
_UniformRandomNumberGenerator2, __s2>::xor_combine() [with
_UniformRandomNumberGenerator1 = std::tr1::subtract_with_carry<short int, 24,
10, 16>; int __s1 = 8; _UniformRandomNumberGenerator2 =
std::tr1::subtract_with_carry<short int, 48, 10, 24>; int __s2 = 2]â
t.cpp:8:12:   required from here
/usr/include/c++/4.8/tr1/random.tcc:793:58: error: no matching function for
call to âmin(std::tr1::xor_combine<std::tr1::subtract_with_carry<short int, 24,
10, 16>, 8, std::tr1::subtract_with_carry<short int, 48, 10, 24>,
2>::result_type, int)â
    __detail::_Shift<result_type, __w - __s1>::__value - 1);
                                                          ^
/usr/include/c++/4.8/tr1/random.tcc:793:58: note: candidates are:
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/string:40,
                 from /usr/include/c++/4.8/tr1/random:38,
                 from t.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const
_Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:   template argument
deduction/substitution failed:
In file included from /usr/include/c++/4.8/tr1/random:48:0,
                 from t.cpp:1:
/usr/include/c++/4.8/tr1/random.tcc:793:58: note:   deduced conflicting types
for parameter âconst _Tpâ (âshort intâ and âintâ)
    __detail::_Shift<result_type, __w - __s1>::__value - 1);
                                                          ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/string:40,
                 from /usr/include/c++/4.8/tr1/random:38,
                 from t.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class
_Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:   template argument
deduction/substitution failed:
In file included from /usr/include/c++/4.8/tr1/random:48:0,
                 from t.cpp:1:
/usr/include/c++/4.8/tr1/random.tcc:793:58: note:   deduced conflicting types
for parameter âconst _Tpâ (âshort intâ and âintâ)
    __detail::_Shift<result_type, __w - __s1>::__value - 1);
                                                          ^
/usr/include/c++/4.8/tr1/random.tcc:797:58: error: no matching function for
call to âmin(std::tr1::xor_combine<std::tr1::subtract_with_carry<short int, 24,
10, 16>, 8, std::tr1::subtract_with_carry<short int, 48, 10, 24>,
2>::result_type, int)â
    __detail::_Shift<result_type, __w - __s2>::__value - 1);
                                                          ^
/usr/include/c++/4.8/tr1/random.tcc:797:58: note: candidates are:
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/string:40,
                 from /usr/include/c++/4.8/tr1/random:38,
                 from t.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note: template<class _Tp> const
_Tp& std::min(const _Tp&, const _Tp&)
     min(const _Tp& __a, const _Tp& __b)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:193:5: note:   template argument
deduction/substitution failed:
In file included from /usr/include/c++/4.8/tr1/random:48:0,
                 from t.cpp:1:
/usr/include/c++/4.8/tr1/random.tcc:797:58: note:   deduced conflicting types
for parameter âconst _Tpâ (âshort intâ and âintâ)
    __detail::_Shift<result_type, __w - __s2>::__value - 1);
                                                          ^
In file included from /usr/include/c++/4.8/bits/char_traits.h:39:0,
                 from /usr/include/c++/4.8/string:40,
                 from /usr/include/c++/4.8/tr1/random:38,
                 from t.cpp:1:
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note: template<class _Tp, class
_Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)
     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
     ^
/usr/include/c++/4.8/bits/stl_algobase.h:239:5: note:   template argument
deduction/substitution failed:
In file included from /usr/include/c++/4.8/tr1/random:48:0,
                 from t.cpp:1:
/usr/include/c++/4.8/tr1/random.tcc:797:58: note:   deduced conflicting types
for parameter âconst _Tpâ (âshort intâ and âintâ)
    __detail::_Shift<result_type, __w - __s2>::__value - 1);
                                                          ^
expected output:

compile clean

Reply via email to