[cfe-dev] Initializer lists and the AST

Vane, Edwin edwin.vane at intel.com
Fri Feb 1 11:42:42 PST 2013

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.

-----Original Message-----
From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu] On Behalf Of Vane, Edwin
Sent: Friday, February 01, 2013 11:42 AM
To: Clang Dev List (cfe-dev at cs.uiuc.edu)
Subject: [cfe-dev] 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?

Edwin Vane
  Software Developer
  Intel of Canada, Inc.

cfe-dev mailing list
cfe-dev at cs.uiuc.edu

More information about the cfe-dev mailing list