This is a bug in the IDE that happens in connection with the prototype generation. Change the IDE settings to verbose compiler output. If you look into the build directory and search for the generated .cpp file you will see the following:
//#define NO_PROBLEM
#ifdef NO_PROBLEM
#include "Arduino.h"
void setup();
void loop();
char charBuf[16];
unsigned int numBuf;
#endif
void setup() {
}
void loop() {
}
vs.
#define NO_PROBLEM
#ifdef NO_PROBLEM
#include "Arduino.h"
void setup();
void loop();
char charBuf[16];
unsigned int numBuf;
#endif
void setup() {
}
void loop() {
}
This explains why the compiler will not compile with the comment.
A workaround is to ensure that there is something that the IDE can pick up before the macro definition which will be optimized away by the compiler. For example
namespace trick17 {};
//#define NO_PROBLEM
#ifdef NO_PROBLEM
char charBuf[16];
unsigned int numBuf;
#endif
void setup() {
}
void loop() {
}
Now the generated .cpp file becomes
#include "Arduino.h"
void setup();
void loop();
namespace trick17 {};
//#define NO_PROBLEM
#ifdef NO_PROBLEM
char charBuf[16];
unsigned int numBuf;
#endif
void setup() {
}
void loop() {
}
And this compiles OK.