C++11: g++-4.7 internal compiler error

It seems that your program requires an unreasonable amount of memory (perhaps because of too many template expansions).

Using a recent g++-trunk :

gcc version 4.8.0 20121026 (experimental) [trunk revision 192860] (GCC) 

with the following zsh limits:

   % limit          
   cputime         unlimited
   filesize        unlimited
   datasize        15000MB
   stacksize       8MB
   coredumpsize    400MB
   memoryuse       15000MB
   maxproc         128166
   descriptors     1024
   memorylocked    64kB
   addressspace    16000MB
   maxfilelocks    unlimited
   sigpending      128166
   msgqueue        819200
   nice            0
   rt_priority     0
   rt_time         unlimited

(this on Debian/Sid/AMD64 with i3770K intel processor & 16Gb RAM)

I am getting:

  % time g++-trunk -std=gnu++11 andrew.cc -o andrew
  virtual memory exhausted: Cannot allocate memory
  g++-trunk -std=gnu++11 andrew.cc -o andrew :
  108.25s user 3.28s system 89% cpu 2:03.98 total

So it seems that template expansion requires so much memory that you program is not reasonable.

I'm not sure if this will be accepted as a GCC bug. The macro expansion for C++ templates is known to be Turing complete and you just hit the wall. And the GCC trunk does report a fatal, but understandable error.

The moral of the story might be to setrlimit(2) appropriately (with limits compatible with your system and hardware), perhaps using limit zsh built-in or ulimit bash built-in.