This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/9437: template function parameter `T*' shouldn't match pointers to members


Synopsis: template function parameter `T*' shouldn't match pointers to members

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Jan 24 20:12:59 2003
State-Changed-Why:
    Something's indeed wrong here. To see what the template
    parameter matches, execute the following variation:
    -------------------------
    extern "C" void printf (const char *, ...);
    
    struct S {
        template <typename T>
        operator T* () const {
          printf ("%s\n", __PRETTY_FUNCTION__);
          return static_cast<T*> (0);
        }
    } null;
    
    struct A { int i; };
    
    static void f (int A::* pmi) { }
    
    int main () { f (null); }
    -----------------------------
    It displays
    g/a> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc
    g/a> ./a.out
    S::operator T*() const [with T = int A::*]
    
    But then the return type would be _pointer_ to member 
    pointer, not member pointer.
    
    Confirmed with 2.95, 3.2.2, 3.3, 3.4
    
    W.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]