File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -273,6 +273,9 @@ Attribute Changes in Clang
273
273
not change the behaviour of the compiler, as this was true for previous
274
274
versions.
275
275
276
+ - Fix a bug where clang doesn't automatically apply the ``[[gsl::Owner]] `` or
277
+ ``[[gsl::Pointer]] `` to STL explicit template specialization decls. (#GH109442)
278
+
276
279
Improvements to Clang's diagnostics
277
280
-----------------------------------
278
281
Original file line number Diff line number Diff line change @@ -8631,6 +8631,7 @@ DeclResult Sema::ActOnClassTemplateSpecialization(
8631
8631
return SkipBody->Previous ;
8632
8632
8633
8633
Specialization->setInvalidDecl (Invalid);
8634
+ inferGslOwnerPointerAttribute (Specialization);
8634
8635
return Specialization;
8635
8636
}
8636
8637
Original file line number Diff line number Diff line change @@ -27,6 +27,11 @@ class vector {
27
27
static_assert (sizeof (vector<int >), " " ); // Force instantiation.
28
28
static_assert (sizeof (vector<int >::iterator), " " ); // Force instantiation.
29
29
30
+ template <>
31
+ class vector <bool > {};
32
+ // CHECK: ClassTemplateSpecializationDecl {{.*}} vector
33
+ // CHECK: OwnerAttr {{.*}}
34
+
30
35
// If std::container::iterator is a using declaration, attributes are inferred
31
36
// for the underlying class.
32
37
template <typename T>
@@ -173,6 +178,18 @@ class reference_wrapper;
173
178
class some_unknown_type ;
174
179
// CHECK: CXXRecordDecl {{.*}} some_unknown_type
175
180
181
+ using size_t = unsigned ;
182
+ inline constexpr size_t dynamic_extent = -1 ;
183
+ template <typename _Tp, size_t _Extent = dynamic_extent>
184
+ class span ;
185
+ // CHECK: CXXRecordDecl {{.*}} span
186
+ // CHECK: PointerAttr {{.*}}
187
+
188
+
189
+ template <typename _Tp>
190
+ struct span <_Tp, dynamic_extent> {};
191
+ // CHECK: ClassTemplatePartialSpecializationDecl {{.*}} span
192
+ // CHECK: PointerAttr {{.*}}
176
193
} // namespace std
177
194
178
195
namespace user {
You can’t perform that action at this time.
0 commit comments