public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/39310]  New: T const assumed to be compatible with int (A::*) (void) const
@ 2009-02-26 13:55 dodji at gcc dot gnu dot org
  2009-02-26 16:56 ` [Bug libstdc++/39310] " jason at gcc dot gnu dot org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: dodji at gcc dot gnu dot org @ 2009-02-26 13:55 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2009-04-07  8:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-26 13:55 [Bug libstdc++/39310] New: T const assumed to be compatible with int (A::*) (void) const dodji at gcc dot gnu dot org
2009-02-26 16:56 ` [Bug libstdc++/39310] " jason at gcc dot gnu dot org
2009-02-27 20:08 ` dodji at gcc dot gnu dot org
2009-03-02  1:47 ` jason at gcc dot gnu dot org
2009-03-02 20:09 ` jason at gcc dot gnu dot org
2009-03-03  8:03 ` paolo dot carlini at oracle dot com
2009-03-03 13:08 ` jason at redhat dot com
2009-03-03 15:46 ` paolo dot carlini at oracle dot com
2009-03-13 17:39 ` paolo dot carlini at oracle dot com
2009-03-15  1:46 ` jason at gcc dot gnu dot org
2009-03-15  2:07 ` paolo dot carlini at oracle dot com
2009-03-31 18:32 ` jason at gcc dot gnu dot org
2009-04-02 14:19 ` dodji at gcc dot gnu dot org
2009-04-07  4:38 ` jason at gcc dot gnu dot org
2009-04-07  8:52 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).