gcc-4.X (4.0 up to 4.3) rejects the following valid c++ code: a private static
member function pointer is passed as a template argument, the function
visibility is resolved in the wrong scope ...

template <void (*fn)(void)>
struct binder {
    inline void foo() {
        (*fn)();
    }
};

struct tester {
private:
    static void foo(void) {}

public:
    binder<&tester::foo> bndr;
};

[EMAIL PROTECTED]:~$ g++-4.3 -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure linux gnu
Thread model: posix
gcc version 4.3.1 20080401 (prerelease) (Debian 4.3.0-3)


-- 
           Summary: wrong visibility with static member function pointers
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim at klingt dot org


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

Reply via email to