This is the mail archive of the gcc-bugs@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]

[Bug c++/16156] New: Fails to identify default pointer-to-member-function arg in template function


struct A {
    void Foo() {}
    };

template<typename T, typename U>
void Bar(T& t, U(T::*f)() = &T::Foo) {}

template<typename T>
void Baq(T& t, void(T::*f)() = &T::Foo) {}

void Baz(A& t, void(A::*f)() = &A::Foo) {}

int main() {
    A a;
    Baz(a, &A::Foo);
    Baz(a);
    Baq(a, &A::Foo);
    Baq(a);
    Bar(a, &A::Foo);
    Bar(a);

    return 0;
    }

Gets you:

~/ootbc/common/test/src$ g++ foo.cc
foo.cc: In function `int main()':
foo.cc:20: error: no matching function for call to `Bar(A&)'

Comeau also reports an error there:

Comeau C/C++ 4.3.3 (Aug  6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing.  All rights reserved.
MODE:strict errors C++

"ComeauTest.c", line 20: error: no instance of function template "Bar" matches the
          argument list
            The argument types that you used are: (A)
      Bar(a);
      ^

So I suppose I should give then a bug report too :-)

Ivan

-- 
           Summary: Fails to identify default pointer-to-member-function arg
                    in template function
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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