We would like to create a proposal for extending the scope of auto keyword and to allow for its usage for declaring class members when using default member initialization.

struct Foo {

    auto bar = makeBar();


In our codebase we encountered a need for this macro:

#define AUTO_MEMBER(NAME, ...) decltype(__VA_ARGS__) NAME = __VA_ARGS__;

To be used as such:

struct Foo {

    AUTO_MEMBER(bar, makeBar())


But this has its limitations and a language support for this use case would be nice.

Is there a reason why this was not done so far? Would this be something worth pursuing?


Dusan Jovanovic