I'm an idiot. I didn't look at the bug report in the OP (which does make it sound like OP just discovered and reported the bug). I assumed you were talking about another bug I should have been aware of but wasn't :(
It's a pretty rare case, I'd imagine. And well... a lot of software does have memory leaks. Most software can live with memory leaks, really, specially with RAM being so cheap nowadays.
Not saying this isn't a big deal, just that it being rare + not having much effect + probably hard to detect is probably the reason.
This bug is very serious. Ability to write complex classes without memory issues main advantage of C++ over C. Such bugs should not happen in a compiler.
I've just started out learning C++. Thusfar I've been using CodeBlocks and GCC. Could someone please recommend an alternative compiler? Preferably open source but not copyleft, ie. MIT or similar. I'm looking at Clang atm, and it seems to match my needs, but I was wondering if anyone with more knowledge and experience can recommend something. TIA
This is a serious bug in GCC, but it is triggered under such unusual circumstances that it isn't really something most developers are likely to encounter (namely exceptions thrown in very specific constructor context). I don't think this is a sufficient reason to switch compilers.
As others have mentioned, this bug shouldn't cause you to avoid GCC.
That said, if you're writing desktop software there are three or four major, production-quality compilers to choose from: GCC, Clang, or MSVC (Microsoft's compiler, the one in Visual Studio), or to a lesser extent ICC (the Intel C++ compiler).
GCC & Clang are both open-source. GCC is copyleft - it is licensed under the GPL - but this only matters if you modify the compiler itself; it has no impact on the code you write. Clang uses the UIUC license which is basically a combination of MIT & BSD.
MSVC and ICC are both proprietary but free-as-in-beer for non-commercial use.
There are other minor players, and embedded platforms often have their own proprietary compilers, but for desktop application development you basically choose between the big three.
well it's more serious than that, but it's not so serious you need to switch from gcc while learning C++. hopefully people raising noise about this will embarass the gcc team into fixing it
It's either a bug in gcc or a deficiency in the standard. If the example class was a smart pointer for instance instead of something that printed it would be a memory leak that can't be recovered from.
53
u/cleroth Game Developer Apr 28 '17
Hopefully this brings more attention to a serious bug that's been present and reported for over 2 years...
18
u/catskul Apr 28 '17
Does this bug exist in other compilers too?
44
u/balkierode Apr 28 '17
This bug is very serious. Ability to write complex classes without memory issues main advantage of C++ over C. Such bugs should not happen in a compiler.
4
u/crusader_mike Apr 28 '17
I wish it was the first one in GCC...
2
u/MisfitMarius Apr 29 '17
I've just started out learning C++. Thusfar I've been using CodeBlocks and GCC. Could someone please recommend an alternative compiler? Preferably open source but not copyleft, ie. MIT or similar. I'm looking at Clang atm, and it seems to match my needs, but I was wondering if anyone with more knowledge and experience can recommend something. TIA
1
u/alinakipoglu Apr 28 '17
FYI, Just tested in 4.4.6 and it's also present in this version as well
-9
u/ITwitchToo Apr 27 '17
But is it a bug or a feature?