Error message: <prompt>:g++ -c bug02.cc bug02.cc: In constructor ?do_something(const T (*)[M])::helper_t::helper_t() [with T = double, int M = 3]?: bug02.cc:10: instantiated from ?void do_something(const T (*)[M]) [with T = double, int M = 3]? bug02.cc:16: instantiated from here bug02.cc:6: internal compiler error: in tsubst_copy, at cp/pt.c:7632 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. The above is with gcc-4.0.0, but the identical happends with gcc-3.4.3 and 4.1.0 20050702 (experimental). The code follows: --------------------------------bug02.cc----------------------------- template<typename T, int M> void do_something( const T A[M][M]) { struct helper_t{ helper_t():B(new double [M*M]){ B[0] = A[0][0]; } ~helper_t(){ delete[] B; } double * B; } helper; } void sub1() { double A[3][3]; do_something(A); } -----------------------------end bug02.cc----------------------------- As always, thank you. You folks do excellent work. Sincerely, Mike Albert
-- Summary: ICE on classes in template functions which attempt closure Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: albertm at uphs dot upenn dot edu CC: gcc-bugs at gcc dot gnu dot org GCC host triplet: x86_64-unknown-linux-gnu (AMD) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22466