[Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const
dodji at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Feb 26 13:55:00 GMT 2009
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
More information about the Gcc-bugs
mailing list