This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/7228: ICE when using member template and template function
- From: ndry at mdcplus dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 7 Jul 2002 06:52:43 -0000
- Subject: c++/7228: ICE when using member template and template function
- Reply-to: ndry at mdcplus dot com
>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
>Closed-Date:
>Last-Modified:
>Originator: ndry@mdcplus.com
>Release: 3.1.1pr and 3.0.4
>Organization:
>Environment:
>Description:
The following code crushes gcc 3.1.1 and 3.0.4 (but not 2.95.4).
-----------------------
#include<iostream>
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;
f(s,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.
>How-To-Repeat:
Compile the above.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: