// SPDX-License-Identifier: UNLICENSED
on 6 lines of trivial example code? Of all the things to make proprietary...Other than that, simply not specifying any license would be equivalent.
edit: bring on the downvotes… doesn't change the fact that fb illegally downloaded a lot of material to train, and so did every other AI company.
https://stackoverflow.com/questions/68332228/spdx-license-id...
https://osec.io/blog/2025-08-11-compiler-bug-causes-compiler...
The better question, in my opinion, is how many other known defects are just sitting there in the GNU buganizer with good reports for more than a decade.
For a concrete example of what this looks like, check out the Homer Simpson -designed "everything" car.
https://media.wired.com/photos/593252a1edfced5820d0fa07/mast...
p.s. Fascinating bug! One of the most interesting cases I've encountered.
Historically C++ only had these separate comparison operators, and operator overloading, and so if you want ordering you'd be expected to override all of the operators and do so in a consistent way. Turns out it's easy enough to get that wrong and if you do now your C++ program is often nonsense, it has no defined meaning whatsoever. For example if a < b && b < a then too bad now many built-in library functions might do absolutely anything in say C++ 17.
With the spaceship operator you're still screwed if your type provides an incoherent ordering (unlike Rust where that just means the type is less useful) but it's much more likely you'll write something which actually works.
There are times that doesn’t work, so documentation usually has a footnote that (1) certain algorithms require a partial ordering and not necessarily a total ordering, and (2) to use those algorithms, you must implement less-than, but any other comparison operator is ignored by the algorithm; instead, less-than is used to figure out greater-than and equal-to as needed. This was considered better than requiring programmers to implement a collection of comparison operators, and trusting those programmers to make those operators act consistently with each other (e.g., never say that “a” and “b” are both less-than and greater-than each other).
The spaceship operator seems to address this specific case ( https://open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0515r0... ). According to Herb Sutter (note that his name is on the proposal), “We added the C++20 spaceship operator to the language, but we also applied it throughout the C++ standard library and that made the library specification nearly 20 pages shorter — a net reduction” ( https://herbsutter.com/2020/12/ ).
The main things I've actually had to watch out for are floating point values that could have not-a-numbers (e.g., https://en.cppreference.com/w/cpp/numeric/math/isunordered.h... ), and possibly Unicode strings that aren't normalized ( https://unicode.org/reports/tr15/ ), but those act weird in all software I'm familiar with. Because people forget about the relevant edge cases.
#define isNan(X) ((X) != (X))> #define isNan(X) ((X) != (X))
> Works by exploiting a unique property of NaN (Not a Number) values in the IEEE-754 floating point standard: a NaN is not equal to itself. In other words, if you compare a floating-point variable to itself and the result is false ((X) != (X)(X)!=(X)), then X X is NaN.
Fantastic example, thank you @spyrja!
i.e. !is_same_v<rational, U>
> The lesson? Always test critical software under multiple compilers and library versions — especially when enabling a new language standard.
Don't have giga-complicated language jockey stuff backing software that can't afford to even have one bug.
The only one that needs to compile Solidity is the person who wrote the Solidity, right? Same with non-blockchain software. So a bug in a Solidity compiler will have the same impact as a bug in any other compiler. At least with regard to executing untrusted code.
Back in 2017, I wrote a comment on HN listing the various WTFs and gotchas I found just from skimming the Solidity docs: https://news.ycombinator.com/item?id=14810008. I went and looked at the current docs, and most of what I wrote back then is still applicable (they did make arithmetic checked by default, and fixed scoping for local variables). There's some other stuff that I missed then that is frankly even more insane - e.g. mappings use solely the hash to look things up (i.e. if you get a hash collision, it will just silently return the wrong value!).
This alone is, to me, a good reason to not trust the ecosystem, given that it's run by people who believe this to be a sensible design for something that handles massive amounts of money.
I wish new C++ standards would make old c++ not work: old code could still be compiled with old compilers, and it would encourage developers to fix their code or rewrite it.
C++ needs it's python2to3 moment.
Cpp2/cppfront feels a bit like that.
I don't mean to say that c++11 to 20 are bad, but they are probably expensive and fastidious to implement.
As for deprecating old C++, yes, I can see the appeal, but no, the community hasn't gone that route. C++ has always been a 'mix and match' approach, with different parts of the community using more or less of the language features, with the intention being that you can choose what to adopt when, and move older code bases forward (or not!) depending on individual concerns.
It's one of the C++ strengths, although it doesn't always feel like it.
No one needs a python 2 to 3 moment. It was not a moment, it was a painful decade or so.
There might be a better way to handle changes in C++, but being like Python is not a good way to go.
I don't know what author meant here. The whole issue exists because G++ overload resolution mechanism was broken.
For most people in computing, a side project is the only way to experience this kind of thing.
vlovich123•5mo ago
twoodfin•5mo ago
You could argue that the latter is the core drive to evolve the standard.
immibis•5mo ago
Most languages deal with this by limiting the features they have - but not C++! (or Scala, which is like Java's C++)
bri3d•5mo ago
Add Boost to the mix, as in this bug, and C++ becomes quite ludicrous really, but it can also combine efficiency, interoperability, and performance in a way that's quite difficult to achieve in other languages.
IMO, starting a good C++ project is an exercise in defining a specific language based on a subset of C++ more than anything else: done right, it can be a big lever, done wrong, it can be a big foot-gun.
ranger_danger•5mo ago
whizzter•5mo ago
Making anything remotely useful out of templates was deeply into hideous SFINAE-land (substitution-failure-is-not-an-error) leading to horrible unreadable templates during 98 (and the variable-number templates in 11 while being useful only made it explode in horrendeous hacks).
"if constexpr" from C++ 17 and forward actually makes template-expansions not too horrid. you can do template expansions that reads mostly like regular if-elseif-else clauses (and I think that was perhaps part of the impetus for Zig's comptime, starting from this point with a clean slate instead of going through regular template evolution hell).
jeffbee•5mo ago
saagarjha•5mo ago
majoe•5mo ago
I haven't seen an example yet, where concepts weren't simpler and easier to read/understand than SFINAE shenanigans.
jeffbee•5mo ago
ranger_danger•5mo ago
addaon•5mo ago
sillysaurusx•5mo ago
saalweachter•5mo ago
But also, since the referenced bug involves Boost... I also haven't used Boost in years, since most everything I was using got pulled into modern C++ versions/STLs.
So if you're using C++98 and Boost, do yourself a favor and just switch to C++17 or 20 or whatever.
bdhcuidbebe•5mo ago
The MAGA version.
tialaramex•5mo ago
G++ has to emit code here to recurse infinitely, so it's not as though there's no opportunity to say "Huh, that probably won't be what they meant"
jcelerier•5mo ago
tialaramex•5mo ago
So the overall story is mostly "Our QA is garbage".
saalweachter•5mo ago
tialaramex•5mo ago
userbinator•5mo ago
wavemode•5mo ago
seanhunter•5mo ago
vlovich123•5mo ago
mgaunard•5mo ago
You should always do extensive testing before upgrading.
reactordev•5mo ago
How much longer will you suffer?
mgaunard•5mo ago
vlovich123•5mo ago
And note this is about an older compiler version using an older library with a “newer” language spec (ie been around 5 years). If you use up to date toolchains there’s less of an issue. This is yet another perennial weakness in the c++ ecosystem that isn’t present in other languages because the standard committee continues to abrogate their duties here.
saghm•5mo ago
Yes, you can fix issues like this with a "hard fork" if you have a large enough consensus, but at that point, does the system of having smart contracts actually improve anything over the one where the software is downstream rather than the source of truth, or are you just replacing one form of "human intervention required" with a different but worse one?
usmannk•5mo ago
tsujamin•5mo ago
tkz1312•5mo ago
saghm•5mo ago
saghm•5mo ago
charcircuit•5mo ago
saghm•5mo ago
charcircuit•5mo ago
saghm•5mo ago
charcircuit•5mo ago
saghm•5mo ago
RealityVoid•5mo ago
eightysixfour•5mo ago
sealeck•5mo ago
You can usually pick the jurisdiction (e.g. many contracts are under jurisdiction of England & Wales/Switzerland/Singapore despite neither party being based there, or doing business there).
I think in general judges are quite considered, and the answers you get from courts tend to make quite a lot of sense, especially if you are aware of general legal principles and precedent.
josefx•5mo ago
saghm•5mo ago
DokDidhuAd•5mo ago
> In C++, when you write an expression like a == b, the compiler chooses among available operator== implementations by comparing their match quality. A member function like a.operator==(b) usually has higher priority than a non-member function like operator==(a, b) — unless the types differ too much or are ambiguous.
This is the largest foot-bazooka ever. The point of operator overloading is that the operator in a given expression look natural, feel natural, and behave naturally (= function intuitively). If you have multiple possible operators that could apply, for the same syntax, then you're in a worse position than you originally were -- where an operator either did one particular thing, or didn't apply at all. What operator overloading does in practice is introduce ambiguity. Which is self-defeating. You are better off with C-style, named, non-overloaded functions.
You will never find this crap in actual math. "match quality" my ass.
maccard•5mo ago
Sure you do. What’s 6/2(1+2)