This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/7906: Templated class with nested non-templated class having an operator() fails to compile
- From: loose at astron dot nl
- To: gcc-gnats at gcc dot gnu dot org
- Date: 13 Sep 2002 07:40:16 -0000
- Subject: c++/7906: Templated class with nested non-templated class having an operator() fails to compile
- Reply-to: loose at astron dot nl
>Number: 7906
>Category: c++
>Synopsis: Templated class with nested non-templated class having an operator() fails to compile
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Sep 13 00:46:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Marcel Loose
>Release: g++ (GCC) 3.2
>Organization:
>Environment:
Linux master 2.4.19 #1 SMP Mon Aug 12 15:33:48 CEST 2002 i686 unknown
>Description:
The code in "How-To-Repeat" is legal, to the best of my knowledge. However, it fails to compile with the following error:
tTemplate.cc:19: no `Templated<T>::NonTemplated::operator std::vector<T,
std::allocator<_CharT> >::size_type() const' member function declared in
class `Templated<T>::NonTemplated'
tTemplate.cc:19: template definition of non-template `
Templated<T>::NonTemplated::operator std::vector<T, std::allocator<_CharT>
>::size_type() const'
>How-To-Repeat:
#include <vector>
template <class T>
class Templated
{
private:
typedef std::vector<T> buf_t;
class NonTemplated
{
public:
operator typename buf_t::size_type() const;
private:
typename buf_t::size_type myIndex;
};
};
template <class T>
Templated<T>::NonTemplated::operator typename Templated<T>::buf_t::size_type() const
{
return myIndex;
}
int main()
{
Templated<int> tmpl;
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: