https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68195
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> --- This works for me on mainline: $ ls Lib.cpp Lib.hpp main.cpp Makefile README.md $ g++ --version g++ (GCC) 6.0.0 20151010 (experimental) 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. $ make test1 g++ -shared -fPIC -o libmyLib.so Lib.cpp -O2 g++ -o main -std=c++11 main.cpp -L. -l myLib LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. ./main I am building GCC-5 branch to see if it fails.