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

             Bug #: 54442
           Summary: Const overloads resolution failure
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: nikko...@hates.ms


gcc fails to take address of const overloads, possibly confused by the index_t
typedef:

$ gcc -v; cat t.cpp; gcc -c t.cpp
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/gcc/4_7_1/libexec/gcc/x86_64-slackware-linux/4.7.1/lto-wrapper
Target: x86_64-slackware-linux
Configured with: ../gcc-4.7.1/configure --prefix=/opt/gcc/4_7_1
--libdir=/opt/gcc/4_7_1/lib64 --enable-languages=c,c++ --enable-threads=posix
--enable-shared --enable-checking=release --with-system-zlib
--disable-libunwind-exceptions --enable-__cxa_atexit
--target=x86_64-slackware-linux --build=x86_64-slackware-linux
--host=x86_64-slackware-linux --enable-multilib
Thread model: posix
gcc version 4.7.1 (GCC) 
namespace X {

struct S
{
    void s (int) const throw ();
    void s (int) throw ();
};

}

extern "C" {
typedef int index_t;
}

namespace X {
using ::index_t;
} 

void (X::S::*f) (X::index_t) = &X::S::s;
void (X::S::*g) (X::index_t) const = &X::S::s;

t.cpp:20:45: error: no matches converting function 's' to type 'void (struct
X::S::*)(index_t)const {aka void (struct X::S::*)(int)const}'
t.cpp:6:10: error: candidates are: void X::S::s(int)
t.cpp:5:10: error:                 void X::S::s(int) const


Thanks.

Liviu

Reply via email to