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 { Index: clang/test/SemaCXX/attr-unavailable.cpp =================================================================== --- clang/test/SemaCXX/attr-unavailable.cpp +++ 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}} +} +}