n3376 15.4 / 4 of std indicates that all decorations and function definitions must have the same cast type. Here:
void f() throw(int); int main() { f(); return 0; } void f() { }
declaration void f() throw(int); , and the definition of void f() { } is global. Thus, they are in conflict because the declaration is for a function that throws an int, while the definition refers to a function without a throw specification.
Now, when you place an ad in the main scop, the definition is not in the same scop, during this scop the definition is unknown, so you can compile.
I hope you understand my English, sorry.
source share