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++/3351: GCC 3.0 does not compile template-friend in nested template-struct.



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


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