In the test file
libstdc++-v3/testsuite/tr1/4_metaprogramming/is_member_function_pointer/value.cc,
the test
VERIFY( (test_category<is_member_function_pointer, int (ClassType::*) (int)
const>(true)) );
should not PASS IMO.

It passes today because of a bug in gcc. More on this in some comments to come
below.

Why shouldn't it PASS ?

Consider:
struct remove_const<T> {};
struct remove_const<T const> 
{
  typedef T type;
};


The  is_member_function_pointer template in the value.cc is written based on
the assumption that the T in the template parameter of

struct remove_const<T const> 
{
  typedef T type;
};

Should deduce to int (A::*) (void), when we try to instantiate 
remove_const<int (A::*) (void) const>; Hence, the current implementation of
is_member_function_pointer assumes that 
struct remove_const<T const> 
{
  typedef T type;
};
should be intantiated.

Actually T const is not compatible with int (A::*) (void) vonst; So it's the
template struct remove_const<T> {}; that should be instantiated. Not its
specialization.

So the test VERIFY( (test_category<is_member_function_pointer,
int (ClassType::*) (int) const>(true)) ); should not PASS.

I will paste in the comments a patch to apply to GCC so that it doesn't compile
that test.


-- 
           Summary: T const assumed to be compatible with int (A::*) (void)
                    const
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dodji at gcc dot gnu dot org


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

Reply via email to