"Undefined reference" linker error... to a function defined in the same file!

I'm sure I'm doing something foolish and I'll feel silly afterwards, but I'm getting an "undefined reference" from the linker when calling a function within the same file! It's obviously not a typo or anything because it's compiling just fine...

So I have a function whose signature looks like this:

int regions_for_time(uint8_t hour, uint8_t minute, uint8_t *regions);

And I define it (of course), and then later in the same file I call it:

void pixels_for_time(time_t time, uint8_t *pixelData) {
  uint8_t regions[16];
  int num_regions;
  num_regions = regions_for_time(0, 0, regions);

And it compiles, but I get a linker error:

core.cpp.o: In function `pixels_for_time(unsigned long, unsigned char*)':
core.cpp:131: undefined reference to `regions_for_time(unsigned char, unsigned char, unsigned char*)'
collect2: error: ld returned 1 exit status

More confusingly, there's another place in the same file where I call the same function, and it doesn't complain about that one.

Any idea what's going on?

I figured it out. The function prototype was correct, but the function definition had a wrong time for one of the arguments. The compiler should complain about this sort of thing, but doesn't, even with -Wall -Wextra. Instead, as far as it's concerned I have two different overloaded functions. The actual implementation is never used, so the optimizer removes it, so I don't even get the useful "did you mean to call this function" message!

It would be really, really, really useful if there was an option to compile Arduino code without optimizations. When I click verify, I want it to verify EVERYTHING, even the parts of the code that are currently dead.

In the meantime I've added -Wmissing-declarations (and for good measure, -Wshadow) to my platform.txt.