[PATCH] D27486: Correct class-template deprecation behavior

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 6 14:49:31 PST 2016


erichkeane removed rL LLVM as the repository for this revision.
erichkeane updated this revision to Diff 80489.
erichkeane added a comment.

Corrected single line statement formatting re-squiggly braces.


https://reviews.llvm.org/D27486

Files:
  lib/Sema/SemaTemplate.cpp
  test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp


Index: lib/Sema/SemaTemplate.cpp
===================================================================
--- lib/Sema/SemaTemplate.cpp
+++ lib/Sema/SemaTemplate.cpp
@@ -2352,6 +2352,9 @@
                                                 ClassTemplate->getLocation(),
                                                      ClassTemplate,
                                                      Converted, nullptr);
+      if (auto *attr = ClassTemplate->getTemplatedDecl()
+                           ->getAttr<clang::DeprecatedAttr>())
+        Decl->addAttr(attr->clone(Context));
       ClassTemplate->AddSpecialization(Decl, InsertPos);
       if (ClassTemplate->isOutOfLine())
         Decl->setLexicalDeclContext(ClassTemplate->getLexicalDeclContext());
Index: test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
===================================================================
--- test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
+++ test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
@@ -23,7 +23,8 @@
 X<char> x1;
 X<int> x2; // expected-warning {{'X<int>' is deprecated}}
 
-template <typename T> class [[deprecated]] X2 {};
+template <typename T> class [[deprecated]] X2 {}; //expected-note {{'X2<char>' has been explicitly marked deprecated here}}
 template <> class X2<int> {};
-X2<char> x3; // FIXME: no warning!
-X2<int> x4;
+X2<char> x3; // expected-warning {{'X2<char>' is deprecated}}
+X2<int> x4; // No warning, the specialization removes it.
+


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D27486.80489.patch
Type: text/x-patch
Size: 1465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161206/15d095f1/attachment.bin>


More information about the cfe-commits mailing list