c++/7228: ICE when using member template and template function

ndry@mdcplus.com ndry@mdcplus.com
Sun Jul 7 05:02:00 GMT 2002

>Number:         7228
>Category:       c++
>Synopsis:       ICE when using member template and template function
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 06 23:56:00 PDT 2002
>Originator:     ndry@mdcplus.com
>Release:        3.1.1pr and 3.0.4

The following code crushes gcc 3.1.1 and 3.0.4 (but not 2.95.4).
template<int N>
struct S {
    enum {I = N};
    template<int NN>
    struct rebind {
        typedef S<NN> Type;

template<class S,class T>
void f(S& s, T& t)
    typename S::rebind<t.I>::Type ss;
    std::cout << ss.I << std::endl; 

int main(){ 
    S<0> s; 
    S<1> t; 

$ g++ test.cc
test.cc: In function `void f(S&, T&) [with S = S<0>, T = S<1>]':
test.cc:21:   instantiated from here
test.cc:14: internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
Compile the above.


More information about the Gcc-bugs mailing list