diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -210,6 +210,9 @@ - Clang now checks for completeness of the second and third arguments in the conditional operator. (`#59718 `_) +- There were some cases in which the diagnostic for the unavailable attribute + might not be issued, this fixes those cases. + (`61815 `_) Bug Fixes in This Version ------------------------- diff --git a/clang/include/clang/Basic/Attr.td b/clang/include/clang/Basic/Attr.td --- a/clang/include/clang/Basic/Attr.td +++ b/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 { diff --git a/clang/test/SemaCXX/attr-unavailable.cpp b/clang/test/SemaCXX/attr-unavailable.cpp --- a/clang/test/SemaCXX/attr-unavailable.cpp +++ b/clang/test/SemaCXX/attr-unavailable.cpp @@ -172,3 +172,13 @@ template int phase_one_unavailable2(int x = unavailable_int()) __attribute__((unavailable)) {} + +namespace GH61815 { +template +class __attribute__((unavailable)) polymorphic_allocator {}; // expected-note 2 {{'polymorphic_allocator' has been explicitly marked unavailable here}} + +void f() { + polymorphic_allocator a; // expected-error {{'polymorphic_allocator' is unavailable}} + polymorphic_allocator b; // expected-error {{'polymorphic_allocator' is unavailable}} +} +}