[PATCH] D147495: [Clang][Attributes] Add MeaningfulToClassTemplateDefinition to unavailable attribute
Shafik Yaghmour via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 3 21:15:40 PDT 2023
shafik created this revision.
shafik added reviewers: rsmith, aaron.ballman, erichkeane.
Herald added a subscriber: inglorion.
Herald added a project: All.
shafik requested review of this revision.
There may be cases in which we want to diagnose a type as unavailable but it may not be complete at the time. Setting `MeaningfulToClassTemplateDefinition` fixes this issue.
This fixes: https://github.com/llvm/llvm-project/issues/61815
https://reviews.llvm.org/D147495
Files:
clang/include/clang/Basic/Attr.td
clang/test/SemaCXX/attr-unavailable.cpp
Index: clang/test/SemaCXX/attr-unavailable.cpp
===================================================================
--- clang/test/SemaCXX/attr-unavailable.cpp
+++ clang/test/SemaCXX/attr-unavailable.cpp
@@ -172,3 +172,13 @@
template <class T>
int phase_one_unavailable2(int x = unavailable_int()) __attribute__((unavailable)) {}
+
+namespace GH61815 {
+template <class _ValueType = int>
+class __attribute__((unavailable)) polymorphic_allocator {}; // expected-note 2 {{'polymorphic_allocator<void>' has been explicitly marked unavailable here}}
+
+void f() {
+ polymorphic_allocator<void> a; // expected-error {{'polymorphic_allocator<void>' is unavailable}}
+ polymorphic_allocator<void> b; // expected-error {{'polymorphic_allocator<void>' is unavailable}}
+}
+}
Index: clang/include/clang/Basic/Attr.td
===================================================================
--- clang/include/clang/Basic/Attr.td
+++ clang/include/clang/Basic/Attr.td
@@ -2848,6 +2848,7 @@
"IR_ARCInitReturnsUnrelated",
"IR_ARCFieldWithOwnership"], 1, /*fake*/ 1>];
let Documentation = [Undocumented];
+ let MeaningfulToClassTemplateDefinition = 1;
}
def DiagnoseIf : InheritableAttr {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147495.510681.patch
Type: text/x-patch
Size: 1219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230404/c1fb733a/attachment.bin>
More information about the cfe-commits
mailing list