https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62229
Bug ID: 62229 Summary: Broken uniform initialization when using std::string ctor Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tnozicka at gmail dot com Hi, IMHO this two examples should have same result, but ... // A std::string s1{10, '\0'}; std::cout << s1.length() << std::endl; // prints 2 - wrong // B std::string s2(10, '\0'); std::cout << s2.length() << std::endl; // prints 10 - right Probable reason is, that A is preferring ctor version with std::initializer_list, but that version (AFAIK) should be invoked as: std::string s1{{10, '\0'}}; === g++ flags === -std=c++14 -Wall -Wextra === configure === Using built-in specs. COLLECT_GCC=/opt/szn/bin/g++-4.9 COLLECT_LTO_WRAPPER=/opt/szn/lib/gcc/x86_64-linux-gnu/4.9.1/lto-wrapper Target: x86_64-linux-gnu Configured with: /home/tomas/packages/gcc/gcc-4.9.1/configure --prefix=/opt/szn --program-suffix=-4.9 --enable-languages=c++ --disable-multilib --enable-shared --enable-threads=posix --enable-checking=release --enable-__cxa_atexit --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-plugin --with-tune=generic --enable-libstdcxx-time=yes --enable-libstdcxx-debug --enable-version-specific-runtime-libs --enable-objc-gc --enable-clocale=gnu --disable-install-libiberty --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu --libdir=/opt/szn/lib --libexecdir=/opt/szn/lib --infodir=/opt/szn/share/info-gcc-4.9 --localedir=/opt/szn/share/locale-gcc-4.9 --mandir=/opt/szn/share/man-gcc-4.9 --with-gxx-include-dir=/opt/szn/include/c++/4.9 Thread model: posix gcc version 4.9.1 (GCC)