This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/7105: g++ 2.95.3 misses candidate function in virtual base of class template
- From: cludwig at cdc dot informatik dot tu-darmstadt dot de
- To: gcc-gnats at gcc dot gnu dot org
- Date: 24 Jun 2002 13:35:54 -0000
- Subject: c++/7105: g++ 2.95.3 misses candidate function in virtual base of class template
- Reply-to: cludwig at cdc dot informatik dot tu-darmstadt dot de
>Number: 7105
>Category: c++
>Synopsis: g++ 2.95.3 misses candidate function in virtual base of class template
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Jun 24 06:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: lidiaadm@cdc.informatik.tu-darmstadt.de
>Release: 2.95.3 20010315 (SuSE)
>Organization:
>Environment:
SuSE Linux 7.3, kernel 2.4.10-4GB, i386
>Description:
g++ 2.95.3 / Linux / i386 fails to compile the attached
file with the following error message:
cludwig@cdcNT42:~/C++/gcc2/tmp> g++ -o bugtest bugtest.cc
bugtest.cc: In method `void B<int>::foo()':
bugtest.cc:59: instantiated from here
bugtest.cc:54: no match for `B<int> & = A<int> &'
bugtest.cc:20: candidates are: class B<int> & B<int>::operator =(const B<int> &)
I expect line 54 to expand to
*this = B<T>(a);
so there is only one user defined conversion involved.
Therefore, the code is legal.
g++ 3.0.3 / Linux / i386 as well as
g++ 2.95.2 / Solaris 8 / sparc compile the example without
error or warning.
The problem shows only if
* A is a class template and
* A is a *virtual* base class of B.
Best regards
Christoph Ludwig
>How-To-Repeat:
g++ -o bugtest bugtest.cc
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="bugtest.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="bugtest.cc"
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnRlbXBsYXRlIDxjbGFz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