User account creation filtered due to spam.

Bug 4137 - conversion operator within template
Summary: conversion operator within template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.0.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2001-08-27 07:06 UTC by benko
Modified: 2003-07-25 17:33 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description benko 2001-08-27 07:06:01 UTC
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;
}

Release:
3.0.1

Environment:
SuSE 7.1
Comment 1 Nathan Sidwell 2002-02-26 14:16:48 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: confirmed
Comment 2 Paolo Carlini 2003-01-02 13:33:45 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Already fixed for 3.3 and 3.4.