[Bug libstdc++/65393] New: std::thread shared_ptr inefficiency
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65393 Bug ID: 65393 Summary: std::thread shared_ptr inefficiency Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: klemensbaum at gmail dot com The std::thread implementation passes around shared_ptr instances by value in multiple places where they could be moved: 1) in the function void thread::_M_start_thread(__shared_base_type __b) the line _M_start_thread(__b, nullptr); could be changed to _M_start_thread(std::move(__b), nullptr); or alternatively take __shared_base_type by universal reference and forward it into the other _M_start_thread overload. 2) in the function void thread::_M_start_thread(__shared_base_type __b, void (*)()) the lines __b-_M_this_ptr = __b; int __e = __gthread_create(_M_id._M_thread, execute_native_thread_routine, __b.get()); could be changed to auto __p = __b.get(); __b-_M_this_ptr = std::move(__b); int __e = __gthread_create(_M_id._M_thread, execute_native_thread_routine, __p); 3) Finally, the use of shared_ptr seems wholly unnecessarily. This can likely be implemented more cleanly with unique_ptr, and more efficiently, since it avoids the extra heap space for the reference count and all of the atomic ops.
[Bug c++/56090] New: Injected-class-name treated as constructor name
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56090 Bug #: 56090 Summary: Injected-class-name treated as constructor name Classification: Unclassified Product: gcc Version: 4.7.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: klemensb...@gmail.com should compile, see ISO/IEC 14882:2011 §9.0.2 $ cat test.cpp struct foo { foo::foo::foo::foo::foo::foo* bar; }; $ g++ test.cpp test.cpp:1:14: error: ‘foo::foo’ names the constructor, not the type $ g++ -v Using built-in specs. COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.1/g++ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.7.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /var/tmp/portage/sys-devel/gcc-4.7.1/work/gcc-4.7.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.7.1 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.1/include/g++-v4 --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --enable-multilib --with-multilib-list=m32,m64 --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.7.1/python --enable-checking=release --disable-libgcj --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.1 p1.0, pie-0.5.3' Thread model: posix gcc version 4.7.1 (Gentoo 4.7.1 p1.0, pie-0.5.3)
[Bug c++/56090] Injected-class-name treated as constructor name
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56090 --- Comment #3 from Klemens klemensbaum at gmail dot com 2013-01-23 22:32:47 UTC --- I would argue that in 3.4.3.1.2 the constructor is not an acceptable lookup result, since it would result in the code being invalid. Additionally, the following use of a type alias (where the constructor is clearly not an acceptable lookup result) does not compile on my g++-4.7.1: struct foo { using bar = foo::foo::foo; };