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]

c++/4137: conversion operator within template



>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:


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