https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63191
--- Comment #4 from Steven Bosscher <steven at gcc dot gnu.org> --- How is one to reproduce this bug with GCC5? I've tried: $ ./xg++ --version xg++ (GCC) 5.0.0 20150407 (experimental) [trunk revision 221906] Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. $ ./xg++ -B. -S -O2 -m32 -fPIC PR63191.cc -fdump-tree-optimized $ cat PR63191.cc.190t.optimized ;; Function (static initializers for PR63191.cc) (_GLOBAL__sub_I_PR63191.cc, funcdef_no=4, decl_uid=14028, cgraph_uid=4, symbol_order=1500) (executed once) (static initializers for PR63191.cc) () { <bb 2>: return; } $ So AFAICT GCC5 optimizes the test case of comment #0 to an empty file. I'm sure there's a way to avoid optimizing this to empty, but I'm not quite a C++ guru ;-)