This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/4137: conversion operator within template
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/4137: conversion operator within template
- From: benko at sztaki dot hu
- Date: 27 Aug 2001 14:03:46 -0000
- Reply-To: benko at sztaki dot hu
>Number: 4137
>Category: c++
>Synopsis: conversion operator within template
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Mon Aug 27 07:06:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Benko Pal
>Release: 3.0.1
>Organization:
>Environment:
SuSE 7.1
>Description:
I do not know whether this is a bug in the compiler or
illegal code.
The following program does not compile:
template <typename c>
struct a
{
typedef int b;
operator b();
};
template <typename c>
a<c>::operator typename a<c>::b() // omitting `typename'
// makes no difference
{
return 0;
}
Workaround:
template <typename c>
struct a
{
typedef int b;
operator b() {return 0;}
};
Without templates there is no problem:
struct a
{
typedef int b;
operator b();
};
a::operator a::b()
{
return 0;
}
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: