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]

c++/8930: bogus ambiguity taking the address of a member template, take 2


>Number:         8930
>Category:       c++
>Synopsis:       bogus ambiguity taking the address of a member template, take 2
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 13 12:06:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     sebor@roguewave.com
>Release:        3.2
>Organization:
>Environment:

>Description:
This still fails with 3.2. The original report, PR 4361, was closed in March 02.

Thanks
Martin

$ cat t.cpp; gcc --version; gcc t.cpp -c; echo $?
template <class T>
class auto_ptr;

template <class T>
struct auto_ptr_ref
{
    template <class U>
    auto_ptr_ref (auto_ptr<U>&) throw () { }
};


template<class T>
struct auto_ptr
{
    template <class U>
    operator auto_ptr_ref<U>() throw () {
        return auto_ptr_ref<U>(*this);
    }

    template <class U>
    operator auto_ptr<U>() throw () {
        return auto_ptr<U>();
    }
};

struct B { };
struct D: B { };

int main ()
{
    auto_ptr<B> (auto_ptr<D>::*pf)() = &auto_ptr<D>::operator auto_ptr<B>;
}
gcc (GCC) 3.2
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

t.cpp: In function `int main()':
t.cpp:32: no matches converting function `operator auto_ptr_ref<U>' to type `
   struct auto_ptr<B> (struct auto_ptr<D>::*)()'
t.cpp:16: candidates are: template<class U> auto_ptr::operator 
   auto_ptr_ref<U>() [with U = U, T = D]
1
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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