我有一个这样的函子,
class PrintParentheses
{
public:
PrintParentheses(unsigned pairsCount)
{}
void operator ()() {}
};
在里面main()
我使用它就像,
#include <iostream>
int main()
{
unsigned pairsCount = 0;
// Error: ‘PrintParentheses pairsCount()’ redeclared as different kind of symbol
PrintParentheses(pairsCount)();
PrintParentheses(5)(); // But this works
}
错误位置标记在代码本身内部。我已经测试了GCC-4.6
和clang-3.1
。两者都给出了相同的错误。