https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86347

--- Comment #2 from stinkingmadgod at gmail dot com ---
Apologies, not familiar with netiquette here

#include<memory>
#include<iostream>
#include<cstdlib>

void* operator new(size_t n)
{
    std::cout << "new\n";
    return std::malloc(n);
}

struct Y
{
    Y() { std::cout << "Y()\n"; }
    Y(const Y&)
    {
        std::cout << "Y(const Y&)\n";
        throw "tantrum"; 
    }
};

struct X {
    X(Y y) noexcept { }
};

int main()
{
    try
    {
        [[maybe_unused]] Y y;
        new X{y};
    }
    catch(...)
    {

    }
}

Online link: http://coliru.stacked-crooked.com/a/53fac07bba9fcb74

Reply via email to