[PATCH] D13330: Implement __attribute__((unique_instantiation))
Keno Fischer via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 27 21:38:57 PDT 2016
loladiro added a comment.
I found a bug in this which I need to fix, but while I'm at it, in doing more testing on this, I came across the following corner case:
template <typename T>
struct static_separate_template {
typedef T element;
static T *a_static_field;
};
extern template struct __attribute__((unique_instantiation)) static_separate_template<int>;
template struct __attribute__((unique_instantiation)) static_separate_template<int>;
extern template struct __attribute__((unique_instantiation)) static_separate_template<char>;
template struct __attribute__((unique_instantiation)) static_separate_template<char>;
template <typename T> typename static_separate_template<T>::element *static_separate_template<T>::a_static_field = nullptr;
template int * __attribute__((unique_instantiation)) static_separate_template<int>::a_static_field;
template char * static_separate_template<char>::a_static_field; // expected-error{{'unique_instantiation' attribute must be specified for all declarations and definitions of this explicit template instantiation}}
How should this be handled? I indicated my inclination in the comment, but I'm open to alternative suggestions.
Repository:
rL LLVM
https://reviews.llvm.org/D13330
More information about the cfe-commits
mailing list