[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Problems with instanciation



>Submitter-Id:	net
>Originator:	Franck Branjonneau
>Organization:	
>Confidential:	no
>Synopsis:	 ice-on-legal-code or rejects-legal on bad instanciation path
>Severity:	
>Priority:	
>Category:	 c++
>Class:		 ice-on-legal-code
>Release:	3.3.3 (Debian 20040401) (Debian testing/unstable)
>Environment:
System: Linux alpha.tchume.net 2.6.6 #1 SMP Mon May 10 15:37:10 UTC 2004 x86_64 GNU/Linux
Architecture: x86_64

	
host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
>Description:
	
g++-3.4 compiles the following code:

#include <iterator>
#include <vector>


template< unsigned _k >
struct I {};

template< unsigned _k >
struct C {

 typedef I< _k > I;

 struct S {};

};

template< unsigned _k >
struct A;

template< unsigned _k >
struct S {

 typedef A< _k > A;

 typedef typename A::IS IS;


 template< int, unsigned _dummy= _k >
 struct Foo;

 template< typename _Iterator >
 inline _Iterator
 foo(
   _Iterator target) const;


 typename A::IS s1_; // # 1
 typename C< _k >::S s2_; // # 2

};

 template< unsigned _k >
 struct A {

  typedef C< _k > C;

  typedef typename C::S IS;

 };


 template< unsigned _k >
 template< unsigned _dummy >
 struct S< _k >::Foo< 0, _dummy > {

  typedef S< _k > S;


  template< typename _Iterator >
  _Iterator
  operator()(
    _Iterator target) const;

 };


 template< unsigned _k >
 template< unsigned _dummy >
 template< typename _Iterator >
 _Iterator
 S< _k >::Foo< 0, _dummy >::operator()(
   _Iterator target) const {

   return target;
 }


 template< unsigned _k >
 template< typename _Iterator >
 inline _Iterator
 S< _k >::foo(
   _Iterator target) const {

   return Foo< 0 >().template operator()(target);
 }


int
main(
  int argc,
  char * argv[]) {

  S< 0 > s;

  s.foo(0);

  std::vector< int > v;
  // s.foo(std::back_inserter(v)); // # 3
}

But, if I uncomment the line # 3, I got (line #1):

error: `S<_k>::s1_' has incomplete type

and g++ seg fault on line #2.
 
>How-To-Repeat:
	
>Fix:
	



Reply to: