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



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to