http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55696
--- Comment #4 from Kyle <kyle.niemeyer at gmail dot com> 2012-12-14 21:25:30 UTC --- It looks like you were right. It must have been linking to the system libstdc++, rather than the one associated with this gcc. When I link using: gfortran -o prog main.o sub.o /usr/local/Cellar/gcc/4.7.2/gcc/lib/libstdc++.a it gives no error. My fault, thanks!