This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3396: template conversion operator
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3396: template conversion operator
- From: Axel dot Zeuner at systor dot com
- Date: 25 Jun 2001 07:53:35 -0000
- Reply-To: Axel dot Zeuner at systor dot com
>Number: 3396
>Category: c++
>Synopsis: template conversion operator
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Jun 25 00:56:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Axel Zeuner
>Release: 2.95.2, 3.0-release, 3.0.1 (prerelease)
>Organization:
>Environment:
Solaris 2.6, Linux
>Description:
Conversion operators of templates classes to typenames typedefed in the template class work only in the body.
>How-To-Repeat:
Compile the test program attached.
>Fix:
Implement conversion operators in templates in the class
body.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="main.cpp"
Content-Disposition: inline; filename="main.cpp"
template <class T>
class X {
public:
typedef T* XY;
operator XY();
};
template <class T>
X<T>::operator X<T>::XY()
{
return XY(0);
}
int main()
{
X<int> p;
int* pp=p;
int rc=0;
if ( pp!= 0) {
rc=1;
}
return rc;
}