From mboxrd@z Thu Jan 1 00:00:00 1970 From: Raphael Poss To: gcc-gnats@gcc.gnu.org Cc: regis@enst.fr Subject: c++/4526: ICE in g++ 3.0.1 when using typeof() as template parameter Date: Wed, 10 Oct 2001 11:26:00 -0000 Message-id: <200110101822.UAA24357@merlin.enst.fr> X-SW-Source: 2001-10/msg00198.html List-Id: >Number: 4526 >Category: c++ >Synopsis: ICE in g++ 3.0.1 when using typeof() as template parameter >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: ice-on-legal-code >Submitter-Id: net >Arrival-Date: Wed Oct 10 11:26:01 PDT 2001 >Closed-Date: >Last-Modified: >Originator: >Release: 3.0.1 >Organization: ENST >Environment: System: SunOS merlin 5.8 Generic_108528-03 sun4u sparc SUNW,Ultra-5_10 Architecture: sun4 host: sparc-sun-solaris2.8 build: sparc-sun-solaris2.8 target: sparc-sun-solaris2.8 configured with: ../configure --prefix=~/gcc --enable-languages=c,c++ : (reconfigured) ../configure --prefix=/infres/ir30/infstag/poss/gcc --enable-languages=c,c++ >Description: G++ 3.0.1 doesn't like the use of typeof() to give a type parameter to a template structure. Given the following code: template struct get_begin { typedef typename T::iterator iterator; static iterator begin(T& c) { return c.begin(); } }; template struct something_t { typedef T some_container; void doit(void) { some_container a; typedef get_begin my_get_begin; // here is the problem typename my_get_begin::iterator i; } }; then G++ 3.0.1 will choke on instanciation of something_t, like in the following code : #include int main(void) { something_t > something; } The error message is : e.cc: In instantiation of `get_begin<__typeof (a(>': e.cc:19: instantiated from here e.cc:4: Internal error: Segmentation Fault Please submit a full bug report, with preprocessed source if appropriate. See for instructions. >How-To-Repeat: # 1 "e.cc" template struct get_begin { typedef typename T::iterator iterator; static iterator begin(T& c) { return c.begin(); } }; template struct something_t { typedef T some_container; void doit(void) { some_container a; typedef get_begin my_get_begin; typename my_get_begin::iterator i; } }; // inclusion of stripped # 24 "e.cc" 2 int main(void) { something_t > something; } >Fix: replace typedef get_begin my_get_begin; by typedef get_begin my_get_begin; >Release-Note: >Audit-Trail: >Unformatted: