@@ -284,11 +284,8 @@ class TrailingObjects
284
284
// / (which must be one of those specified in the class template). The
285
285
// / array may have zero or more elements in it.
286
286
template <typename T> T *getTrailingObjects () {
287
- verifyTrailingObjectsAssertions<true >();
288
- // Forwards to an impl function with overloads, since member
289
- // function templates can't be specialized.
290
- return this ->getTrailingObjectsImpl (
291
- static_cast <BaseTy *>(this ), TrailingObjectsBase::OverloadToken<T>());
287
+ return const_cast <T *>(
288
+ static_cast <const TrailingObjects *>(this )->getTrailingObjects <T>());
292
289
}
293
290
294
291
// getTrailingObjects() specialization for a single trailing type.
@@ -306,13 +303,8 @@ class TrailingObjects
306
303
}
307
304
308
305
FirstTrailingType *getTrailingObjects () {
309
- static_assert (sizeof ...(TrailingTys) == 1 ,
310
- " Can use non-templated getTrailingObjects() only when there "
311
- " is a single trailing type" );
312
- verifyTrailingObjectsAssertions<false >();
313
- return this ->getTrailingObjectsImpl (
314
- static_cast <BaseTy *>(this ),
315
- TrailingObjectsBase::OverloadToken<FirstTrailingType>());
306
+ return const_cast <FirstTrailingType *>(
307
+ static_cast <const TrailingObjects *>(this )->getTrailingObjects ());
316
308
}
317
309
318
310
// Functions that return the trailing objects as ArrayRefs.
@@ -342,9 +334,8 @@ class TrailingObjects
342
334
}
343
335
344
336
template <typename T> T *getTrailingObjectsNonStrict () {
345
- verifyTrailingObjectsAssertions<false >();
346
- return this ->getTrailingObjectsImpl (
347
- static_cast <BaseTy *>(this ), TrailingObjectsBase::OverloadToken<T>());
337
+ return const_cast <T *>(static_cast <const TrailingObjects *>(this )
338
+ ->getTrailingObjectsNonStrict <T>());
348
339
}
349
340
350
341
template <typename T>
0 commit comments