Skip to content

Instantly share code, notes, and snippets.

@EricWF
Last active December 10, 2015 12:33
Show Gist options
  • Select an option

  • Save EricWF/7eb0c5dd4857c73d7828 to your computer and use it in GitHub Desktop.

Select an option

Save EricWF/7eb0c5dd4857c73d7828 to your computer and use it in GitHub Desktop.
// g++ -std=c++11 test.cpp
template <class Tp>
struct MyType {
__attribute__((visibility("hidden"), always_inline)) ~MyType();
};
// Moving the definition above this line will allow the compilation to succeed. Why?
extern template __attribute__((visibility("default"))) MyType<int>::~MyType();
// DEFINITION
template <class Tp> inline MyType<Tp>::~MyType() {}
// Other is a class that requires the definition of MyType<size_t>::~MyType()
struct GeneratedDtor { MyType<int> t; };
GeneratedDtor o;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment