空隙();空括号无效

时间:2018-05-26 06:44:50

标签: c++ language-lawyer

为什么void();这里不会导致编译错误?

编译器如何根据标准对其进行解释?

class X;

int main()
{
    //void(int);    error: expected primary-expression before 'void'
    //void(void);   error: expected primary-expression before 'void'
    //void;         error: declaration does not declare anything [-fpermissive]
    //X();          error: invalid use of incomplete type 'class X'
    void(0);    // functional cast expression to void?
    void();     // ???
}

0 个答案:

没有答案