@@ -284,11 +284,8 @@ class TrailingObjects
284284 // / (which must be one of those specified in the class template). The
285285 // / array may have zero or more elements in it.
286286 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>());
292289 }
293290
294291 // getTrailingObjects() specialization for a single trailing type.
@@ -306,13 +303,8 @@ class TrailingObjects
306303 }
307304
308305 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 ());
316308 }
317309
318310 // Functions that return the trailing objects as ArrayRefs.
@@ -342,9 +334,8 @@ class TrailingObjects
342334 }
343335
344336 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>());
348339 }
349340
350341 template <typename T>
0 commit comments