The fact that this rule is applicable in your case is not deliberate: It's ultimately a result of keeping the grammar simple. There is no incentive to prohibit declarations such as yours, but there are great disincentives to complicate rules, especially if those are intricate as they are.
In short, if you don't want to use this needlessly obfuscated syntax, don't.
C++ rarely forces you to write readable code.
Surprisingly there are scenarios in which parentheses can save the day, though:
std::string foo();
namespace detail
{
int foo(long); // Another foo
struct Bar
{
friend std::string ::foo(); // Doesn't compile for obvious reasons.
friend std::string (::foo)(); // Voilà!
};
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…