[Development] QVariant and types with throwing dtors

Marc Mutz marc.mutz at qt.io
Mon Aug 26 19:08:02 CEST 2024


On 26.08.24 11:08, Giuseppe D'Angelo via Development wrote:
> Il 26/08/24 07:24, Marc Mutz via Development ha scritto:
>> IMHO, (1) is not an acceptable option. Us C++ professionals having 
>> identified
>> this problem after years of it lying dormant, it behooves us, at the
>> very least, to educate our users about this, e.g. by adding docs, and
>> maybe a qWarning() in ~QVariant(), if we don't do (2).
> 
> For clarity, what is "this problem" that are you referring to? Throwing 
> destructors? Using types with throwing destructors in containers?

 From Fabian's thread starter:

> QVariant. Even though it's own destructor is noexcept, it doesn't reject types whose destructor is potentially throwing.

Dtor of payload throwing in noexcept ~QVariant -> std::terminate.

-- 
Marc Mutz <marc.mutz at qt.io> (he/his)
Principal Software Engineer

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
www.qt.io

Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B



More information about the Development mailing list