File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
lib/inc/sys_string/impl/platforms Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -451,6 +451,18 @@ namespace sysstr::util
451451 obj.ready = value;
452452 }
453453
454+ template <typename T, typename = int >
455+ struct HasStaticallyAllocatedMember : std::false_type { };
456+
457+ template <typename T>
458+ struct HasStaticallyAllocatedMember <T, decltype ((void )T::statically_allocated, 0 )> : std::true_type { };
459+
460+ template <class T >
461+ constexpr void gccIsAPieceOfShit_assignStaticallyAllocated (T & obj, int value) {
462+ if constexpr (HasStaticallyAllocatedMember<T>::value)
463+ obj.statically_allocated = value;
464+ }
465+
454466 template <class T >
455467 constexpr void gccIsAPieceOfShit_assignData (T & obj, void * data) {
456468 obj.any = data;
@@ -474,6 +486,7 @@ namespace sysstr::util
474486 gccIsAPieceOfShit_assignHash (this ->_base ._base ); // pypy lacks hash in PyASCIIObject
475487 this ->_base ._base .state .kind = Kind;
476488 gccIsAPieceOfShit_assignReady (this ->_base ._base .state , 1 );
489+ gccIsAPieceOfShit_assignStaticallyAllocated (this ->_base ._base .state , 1 );
477490 gccIsAPieceOfShit_assignData (this ->data , const_cast <void *>(chars));
478491 if constexpr (Kind == PyUnicode_1BYTE_KIND)
479492 {
You can’t perform that action at this time.
0 commit comments