struct Outer_t{
private:
struct Inner_t {
int A;
int B;
};
//const Inner_t NotStored = Inner_t{-1, -1}; <<-- works
const auto NotStored = Inner_t{-1, -1}; <<-- error: 'auto' is not allowed here
};
Why is auto not allowed here? If I move Inner_t
out of the enclosing struct, then it works fine.
struct Plain_t {
int A;
int B;
};
//const Plain_t NotStored = Plain_t{-1, -1}; <<-- works
const auto NotStored = Plain_t{-1, -1}; <<-- now it works
For the record I'm using clang 13:
% clang --version Homebrew clang version 13.0.1 Target: x86_64-apple-darwin21.5.0 Thread model: posix InstalledDir: /usr/local/opt/llvm/bin