Here is the code which causes a compile-time error:
#include <iostream>
int a;
void f()
{
using ::a;
using ::a; //'a' is already declared in this scope.
}
int main(){ }
What the standard says is (N4296::7.3.3/10 [namespace.udecl]
):
A using-declaration is a declaration and can therefore be used repeatedly where (and only where) multiple declarations are allowed.
So, I supposed that any redeclaration is ill-formed in the block scope. But the program
#include <iostream>
void f()
{
extern int a;
extern int a;
}
int main(){ }
works fine. So why is the using redeclaration actually prevented from appearing twice in the block scope?