This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/4361: gcc 3.0.1 bogus ambiguity taking the address of a member template
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4361: gcc 3.0.1 bogus ambiguity taking the address of a member template
- From: sebor at roguewave dot com
- Date: 19 Sep 2001 16:21:40 -0000
- Reply-To: sebor at roguewave dot com
>Number: 4361
>Category: c++
>Synopsis: gcc 3.0.1 bogus ambiguity taking the address of a member template
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Sep 19 09:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: sebor@roguewave.com
>Release: gcc 3.0.1
>Organization:
>Environment:
>Description:
This is reduced from our auto_ptr testsuite. The compiler
is confused by the two conversion operators. 2.95.2 ICEs
on this code.
Regards
Martin
>How-To-Repeat:
$ cat t.cc ; g++ t.cc
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>;
}
t.cc: In function `int main()':
t.cc:32: no matches converting function `operator auto_ptr_ref<U>' to type
`struct auto_ptr<B> (struct auto_ptr<D>::*)()'
t.cc:16: candidates are: template<class U> auto_ptr::operator auto_ptr_ref<U>()
[with U = U, T = D]
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: