I've had a compiler error that was very sneaky and only happened in certain build configurations. Because it was a compiler error, it was caught before heading into production, but it happened just before the final build, so it lead to a stressful hour or two for me ("Hey, the thing we're supposed to ship very soon fails compilation on the platform we're shipping it on!"). Here is a much simplified version of the issue:
doSomething(),
DEBUG_MACRO("Print some text");
And mistakenly put a comma instead of semicolon at the end of the first row. I didn't notice the typo, because it compiled and ran just fine: the thing on the left of the comma and the thing on the right were both expressions, which is valid with the C "comma operator". But, on some build settings, "DEBUG_MACRO" became an if statement (it expanded to something like "if (debuggingIsOn) ..."), which is not an expression and thus not valid with the comma operator.
Lesson learned: always build and test all build configurations continuously during development. Don't leave it to the last minute.
We had the software version defined as a macro in the header file. This worked absolutely fine for version 0 to version 7 and then stopped compiling at version 08.
It turned out, the original author had written it as a 2 digit number for consistency, like this: 03
In C, a leading 0 indicates the number is octal, so 07 is a valid number, but 08 is not.
Lesson learned: always build and test all build configurations continuously during development. Don't leave it to the last minute.