Initializer lists and the AST

I have two statements I'm looking at for replacing the type specifier with 'auto':

  std::vector<int>::iterator begin2{blah.begin()};
  std::vector<int>::iterator begin3 = {blah.begin()};

The end result is that the first line should use auto and the second should not (auto will turn into std::initializer_list). However, when I dump the parts of the AST corresponding to the initializers, I get exactly the same thing. How can I differentiate these two cases? Should I be looking in the VarDecl for some clue?

For anybody else who cares about the answer, the trick in this case is that CXXConstructExpr has a member function isListInitialized(). The flag doesn't show up in the dump but the function returns what you'd expect.

For anybody else who cares about the answer, the trick in this case is that CXXConstructExpr has a member function isListInitialized(). The flag doesn't show up in the dump but the function returns what you'd expect.

Alternatively, you can use VarDecl::getInitStyle. It's VarDecl::CInit
for copy-initialization (including copy-list-initialization) and
VarDecl:::ListInit for direct-list-initialization.