c++/9282: compiler rejects to get function pointers to static member functions in template arguments

bangerth@dealii.org bangerth@dealii.org
Mon Jan 13 17:03:00 GMT 2003


Synopsis: compiler rejects to get function pointers to static member functions in template arguments

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Mon Jan 13 09:03:34 2003
State-Changed-Why:
    Confirmed. Here's a simpler testcase:
    --------------------------------
    struct CPU {
        typedef int (*pfun)();
    
        template <pfun step1>
        static int dispatch() {
            return (*step1)();
          }
    
        template<int displacement>
        static int foo();
    };
    
    template int CPU::dispatch<&CPU::foo<2> > ();
    -------------------------
    
    I think it should compile, but does not:
    tmp/g> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.cc
    x.cc: In static member function `static int CPU::dispatch() [with int
       (*step1)() = CPU::foo() [with int displacement = 2]]':
    x.cc:13:   instantiated from here
    x.cc:6: error: no matching function for call to `CPU::foo()'
    
    This has not worked at least since 2.95.
    
    W.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9282



More information about the Gcc-prs mailing list