[clang] [clang] Diagnose use of deprecated template alias (PR #97619)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 16 08:04:29 PDT 2024


================
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+//
+// This test checks that a deprecated attribute on an alias
+// template triggers a warning diagnostic when it is used.
+
+template <typename T>
+struct NoAttr {
+  void foo() {}
+};
+
+// expected-note at +2 5{{'UsingWithAttr' has been explicitly marked deprecated here}}
+template <typename T>
+using UsingWithAttr __attribute__((deprecated)) = NoAttr<T>;
----------------
tahonermann wrote:

I recommend adding a test that uses the C++11 `[[deprecated]]` attribute syntax.

https://github.com/llvm/llvm-project/pull/97619


More information about the cfe-commits mailing list