This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/3351: GCC 3.0 does not compile template-friend in nested template-struct.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c++/3351: GCC 3.0 does not compile template-friend in nested template-struct.
- From: whiskey at i100 dot ryd dot student dot liu dot se
- Date: Fri, 22 Jun 2001 00:45:25 GMT
>Number: 3351
>Category: c++
>Synopsis: GCC 3.0 does not compile template-friend in nested template-struct.
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Jun 21 17:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Jens Lindström
>Release: 3.0
>Organization:
Opera Software
>Environment:
System: Linux tooth 2.4.3-xfs-1.0 #3 Wed May 2 22:56:26 CEST 2001 i686 unknown
Architecture: i686
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc-3.0/configure --sysconfdir=/etc --localstatedir=/var --prefix=/usr/pkg/gcc-3.0 --enable-threads --enable-languages=c++
>Description:
The following code works correctly:
#include <iostream>
using namespace std;
template <class T> struct s;
template <class T>
ostream& operator<<(ostream &o, const typename s<T>::t &x)
{
return o;
}
template <class T>
struct s {
struct t
{
friend ostream&
operator<<<T>(ostream&, const typename s<T>::t &);
};
t x;
};
int main()
{
s<int>::t y;
cout << y;
}
but if the member 'x' in 'struct s' is removed, the compliler issues the following
error:
templ.cc: In instantiation of `s<int>::t':
templ.cc:24: instantiated from here
templ.cc:17: `ā%@ā@' redeclared as different kind of symbol
templ.cc:17: sorry, not implemented: `integer_cst' not supported by dump_decl
cc1plus: previous declaration of `<declaration error>'
templ.cc:17: confused by earlier errors, bailing out
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: