================ @@ -72,3 +72,58 @@ template <class B1> struct B { template struct B<A>; // expected-note {{requested here}} } // namespace GH58547 + + +namespace GH44496 { + template <class> struct my_template { + using type = void; +}; + +template <class T> +struct [[deprecated("primary")]] deprecated { // #deprecated-primary-marked-here + using type = T; +}; + +template <class T> +struct my_template<volatile T> : deprecated<T> {}; // #deprecated-primary-base + +template <class T> +struct [[deprecated("specialization")]] my_template<const T> : deprecated<const T> {}; // #my_template-explicit-here + + +template <class T> using my_template_t = typename my_template<T>::type; // #deprecated-my-template-alias + +// We cannot warn on X because no instantiation has taken place yet +using X = my_template<volatile int>; + +// Because we already warn on the attribute on the plimary template, we ignore the attribute on the specialization +using Y = my_template_t<const int>; +// expected-warning@#deprecated-primary-base {{'deprecated<int>' is deprecated: primary}} \ +// expected-note@-1 {{in instantiation of template type alias}} \ +// expected-note@#deprecated-primary-marked-here {{has been explicitly marked deprecated here}} + +using Z = my_template_t<volatile int>; +// expected-warning@#deprecated-my-template-alias {{'my_template<const int>' is deprecated: specialization}} \ +// expected-note@#my_template-explicit-here {{'my_template<const int>' has been explicitly marked deprecated here}} \ +// expected-note@#deprecated-my-template-alias {{in instantiation of template class 'GH44496::my_template<volatile int>' requested here}} \ +// expected-note@-1 {{in instantiation of template type alias 'my_template_t' requested here}} + +template <class T> +struct primary_not_deprecated { + using type = T; +}; +template <class T> +struct [[deprecated("specialization")]] primary_not_deprecated<volatile T> : deprecated<T> {}; +// expected-note@-1 {{'primary_not_deprecated<volatile int>' has been explicitly marked deprecated here}} + +// We cannot warn on S1 because no instantiation has taken place yet +using S1 = primary_not_deprecated<volatile int>; + + +using S2 = primary_not_deprecated<volatile int>; + +X x; +Z z; +S2 s2; ---------------- shafik wrote:
Maybe I am missing it but it does not look like you test the exact same case that the original issue reported. It would be good to demonstrate that it actually fixes the original reported issue. https://github.com/llvm/llvm-project/pull/138426 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits