[cfe-dev] clang++ and extended initializer lists

Csaba Raduly rcsaba at gmail.com
Fri Dec 17 02:49:22 PST 2010


Hi all,

I built clang version 2.9 (trunk 122051) on OpenSUSE 11.3 x86_64 using
its default compiler: gcc version 4.5.0 20100604 [gcc-4_5-branch
revision 160292] (SUSE Linux)
Then I tried to build clang with the newly built clang (configured in
another directory with CC=$HOME/bin/clang CXX=$HOME/bin/clang++), but
got the following error:

llvm[1]: Compiling Disassembler.cpp for Release+Asserts build
In file included from /home/csabe/LLVM/llvm/lib/Support/Disassembler.cpp:19:
/usr/include/c++/4.5/iomanip:63:12: error: expected expression
  { return { __mask }; }

This is because GCC's headers in this version use extended initializer lists:

  struct _Resetiosflags { ios_base::fmtflags _M_mask; };

  /**
   *  @brief  Manipulator for @c setf.
   *  @param  mask  A format flags mask.
   *
   *  Sent to a stream object, this manipulator resets the specified flags,
   *  via @e stream.setf(0,mask).
  */
  inline _Resetiosflags
  resetiosflags(ios_base::fmtflags __mask)
  { return { __mask }; }

When compiling a hand-made equivalent of the above, G++ warns
"extended initializer lists only available with -std=c++0x or
-std=gnu++0x". clang++ refuses to accept this even with -std=c++0x :(

Is this something that is not yet supported by clang++ ?

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds



More information about the cfe-dev mailing list