http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53586
Bug #: 53586 Summary: Internal compiler errors on cp/pt.c:12077 and expr.c:9147 Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: paulotorr...@gnu.org Trying to compile this small function: template<typename T> auto ptr2bitmap(T *bitmap, int width, int depth = 3) -> typeof(typeof(unsigned char[depth])[width]) *{ return bitmap; }; I got this: Compiling `mjpeg.cpp'... mjpeg.cpp: In substitution of 'template<class T> unsigned char (* ptr2bitmap(T*, int, int))[width][depth] [with T = void]': mjpeg.cpp:223:39: required from here mjpeg.cpp:200:27: internal compiler error: in tsubst_copy, at cp/pt.c:12077 Please submit a full bug report, with preprocessed source if appropriate. See <https://trac.macports.org/newticket> for instructions. make: *** [mjpeg.o] Error 1 And, trying to compile this code: using uc3 = unsigned char[3]; using uc3w = uc3[width]; using uc3wp = uc3w *; auto img = (uc3wp)rgb; int w = 0; for(w = 0; w < font_GMT_width; w++) { for(int y = 0; y < font_height; y++) { ((img[y])[w])[0] = font_pixel(font_GMTX + w, y, 0); ((img[y])[w])[1] = font_pixel(font_GMTX + w, y, 1); ((img[y])[w])[2] = font_pixel(font_GMTX + w, y, 2); }; }; auto add = [&](int start) { for(int x = 0; x < font_char_width; x++, w++) { for(int y = 0; y < font_height; y++) { ((img[y])[w + x])[0] = font_pixel(start + x, y, 0); ((img[y])[w + x])[1] = font_pixel(start + x, y, 1); ((img[y])[w + x])[2] = font_pixel(start + x, y, 2); }; }; }; auto add_colon = [&] { add(font_ColonX); }; auto add_slash = [&] { add(font_SlashX); }; I got this: mjpeg.cpp: In static member function 'static void std::_Function_handler<void(_ArgTypes ...), _Functor>::_M_invoke(const std::_Any_data&, _ArgTypes ...) [with _Functor = MJPEG::Video::addJpg(void*, size_t, double, tm*) const::<lambda(void*, size_t, size_t)>; _ArgTypes = {void*, long unsigned int, long unsigned int}]': mjpeg.cpp:228:20: internal compiler error: in expand_expr_real_1, at expr.c:9147 Please submit a full bug report, with preprocessed source if appropriate. See <https://trac.macports.org/newticket> for instructions. make: *** [mjpeg.o] Error 1 All tests were run on a Mac OS X Lion machine, and GCC as configured as follow: ../gcc-4.7.0/configure --prefix=/opt/local --build=x86_64-apple-darwin11 --enable-languages=c,c++,objc,obj-c++,lto,fortran,java --libdir=/opt/local/lib/gcc47 --includedir=/opt/local/include/gcc47 --infodir=/opt/local/share/info --mandir=/opt/local/share/man --datarootdir=/opt/local/share/gcc-4.7 --with-libiconv-prefix=/opt/local --with-local-prefix=/opt/local --with-system-zlib --disable-nls --program-suffix=-mp-4.7 --with-gxx-include-dir=/opt/local/include/gcc47/c++/ --with-gmp=/opt/local --with-mpfr=/opt/local --with-mpc=/opt/local --with-ppl=/opt/local --with-cloog=/opt/local --enable-cloog-backend=isl --enable-stage1-checking --disable-multilib --enable-lto --with-as=/opt/local/bin/as --with-ld=/opt/local/bin/ld --with-ar=/opt/local/bin/ar --with-bugurl=https://trac.macports.org/newticket --with-pkgversion='MacPorts gcc47 4.7.0_3'