2 ms·
I'm more talking about the exception behavior looking at e.g. https://wandbox.org/permlink/S5paK3Z9NpeCv3I0 https://wandbox.org/permlink/S5paK3Z9NpeCv3I0 (which
by mnarayan01 9y ago
I'm more talking about the exception behavior looking at e.g. https://wandbox.org/permlink/S5paK3Z9NpeCv3I0 https://wandbox.org/permlink/S5paK3Z9NpeCv3I0 (which exhibits the same bug). I mean you're right, and the fact that the User object is temporary should presumably not keep the first Resource destructor from firing, just it seems weird. I guess in my defense, apparently it seems weird to GCC as well.
- JonathonW 9y agoThe spec also explicitly addresses that (automatic objects' destructors must be called after an exception)-- see section 15.2 in the C++14 spec. There is no ambiguity in the spec here; this is a GCC bug.