https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52389
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Blocks| |120170
Status|NEW |WAITING
--- Comment #9 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed testcase:
#include <locale>
#include <stdlib.h>
#include <stdio.h>
#include <new>
#include <stddef.h>
#include <stdint.h>
void* operator new[](size_t size)
{
char* p = (char*)malloc(size + 16);
if(!p) throw std::bad_alloc();
*(uint32_t*)p = 0x12345678;
return p + 16;
}
void operator delete[](void* p) noexcept
{
char* p2 = (char*)p - 16;
if(*(uint32_t*)p2 != 0x12345678)
printf("block was not allocated with new[]\n");
free(p2);
}
void operator delete [](void* p, std::size_t) noexcept { operator delete(p); }
struct F : std::locale::facet
{
F() : facet(0) {}
static std::locale::id id;
};
std::locale::id F::id;
int main()
{
std::locale path_locale(std::locale(), new F);
return 0;
}
This seems to work fine on x86_64-w64-mingw32 when testing under Wine.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120170
[Bug 120170] [meta-bug] C++ std::locale