Skip to content

Instantly share code, notes, and snippets.

@CFSworks
Created January 2, 2019 11:55
Show Gist options
  • Save CFSworks/de1a858771c846e9ab57999571c1715c to your computer and use it in GitHub Desktop.
Save CFSworks/de1a858771c846e9ab57999571c1715c to your computer and use it in GitHub Desktop.
LLVM LTO bug
#include "common.h"
X<int> *make_X()
{
return new X<int>;
}
#include "common.h"
template class X<int>;
class BaseClass {
public:
~BaseClass() { };
};
template<typename T>
class X : public BaseClass {
public:
virtual ~X() { };
};
libbug.so: a.o b.o
clang++ -O1 -flto -shared -o $@ $^
%.o: %.cpp common.h
clang++ -O1 -flto -o $@ -c $<
clean:
rm libbug.so a.o b.o
.PHONY: clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment