error: anachronistic old-style base class initializer

前端 未结 3 1495
后悔当初
后悔当初 2020-12-14 05:53

The following code produces the subsequent compilation error on all versions of GCC that I\'ve tried, in C++98, C++11 and C++14 modes:

struct T
{
    T(void*         


        
3条回答
  •  半阙折子戏
    2020-12-14 06:27

    This was described specifically in the ARM, Section 18.3.2 as an anachronism.

    The reason for such features was, typically, providing continuity to older versions of C++ or to C with classes. All "anachronisms" had undesirable characteristics. Compilers were not required to provide such features but, if they did, were obliged to permit a programmer to deactivate it and/or be warned about using it.

提交回复
热议问题