What's the c++ inline class?

前端 未结 3 926
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-31 15:41

I accidentally found that the Clang compiler allows :

inline class AAA
{
};

in C++. What\'s this?


PS. I reported this to Clang ma

3条回答
  •  执笔经年
    2021-01-31 15:55

    clang shouldn't allow this, inline can only be used in the declaration of functions, from ISO/IEC 14882:2003 7.1.2 [dcl.fct.spec] / 1 :

    Function-specifiers can be used only in function declarations.

    inline is one of three function-specifiers, virtual and explicit being the others.

    As @MatthieuM notes, in the next version of C++ (C++0x), the inline keyword will also be allowed in namespace definitions (with different semantics to inline as a function-specifier).

提交回复
热议问题