Boost's call_traits_test.cpp

Paolo Carlini pcarlini@unitus.it
Wed Apr 25 09:29:00 GMT 2001


Hi all,

today I investigated in some more detail this remaining failure (the
other 3 are due to the obnoxious long long in templates problem...
Nathan Sidwell has a patch in progress!).

Basically, in lines 252-255, 4 tests are carried, which, however seems
not supported by 3.0 as was for 2.95.2 :( :

    /* */

   // cv-qualifiers applied to reference types should have no effect
   // declare these here for later use with is_reference and
remove_reference:
   typedef int& r_type;
   typedef const r_type cr_type;

    /* */

#if !(defined(__GNUC__) && (__GNUC__ < 3))
   type_test(int&, boost::call_traits<cr_type>::value_type)
   type_test(int&, boost::call_traits<cr_type>::reference)
   type_test(const int&, boost::call_traits<cr_type>::const_reference)
   type_test(int&, boost::call_traits<cr_type>::param_type)

    /* */


Those 4 tests fail.
The reason is that, apparently, Gcc3.0 (as 2.95.2) as some trouble
dealing with cv-qualified types in template instantiation. For instance,
for a call_traits<const int&>::value_type, Gcc3.0 ends up instantiating
the less specialized (the first one) of the following two templates, as
if lead in error by a not-discarded cv-qualification:

template <typename T>
struct call_traits
{
public:
   typedef T value_type;
   typedef T& reference;
};

template <typename T>
struct call_traits<T&>
{
   typedef T& value_type;
   typedef T& reference;
};


Of course, a reference to reference compilation error systematically
occurs.

Now, the problem seems to me quite clear.

Do you agree with my analysis?
In particular must in fact cv-qualifiers be discarded according to the
standard? In that case, the problem is already known and dealt with by
the Gcc developers???

Thanks,
Paolo.




More information about the Gcc mailing list