Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 391281 - sys-devel/gcc: rvalue reference erroneously decays into lvalue one
Summary: sys-devel/gcc: rvalue reference erroneously decays into lvalue one
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal major (vote)
Assignee: Gentoo Linux bug wranglers
Depends on:
Reported: 2011-11-21 18:48 UTC by Andrey Vul
Modified: 2011-11-21 19:10 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Andrey Vul 2011-11-21 18:48:23 UTC
Even though an rvalue reference is being declared by use of std::move, gcc decays it to an lvalue one before performing argument-dependent lookup for the correct version of operator=. This, in turn, breaks functionality of MoveAssignable and MoveConstructable but neither CopyAssignable nor CopyConstuctable objects.

Reproducible: Always

Steps to Reproduce:
Compile the following:
#include <iostream>
#include <fstream>
#include <algorithm>
#include <utility>

using namespace std;
int main() {
	ifstream f;
	ifstream g;
	f = move(g);

Actual Results:  
Failure to compile due to decay to lvalue and gcc calling std::ifstream::operator=(const std::ifstream&), which is marked private and/or deleted.

Expected Results:  
The code compiles without error.

This bug is present both in gcc:4.5 and 4.6.

emerge --info:
Portage 2.2.0_alpha76 (default/linux/amd64/10.0/desktop, gcc-4.6.2, glibc-2.13-r4, 2.6.33-pf4 x86_64)
System uname: Linux-2.6.33-pf4-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T9400_@_2.53GHz-with-gentoo-2.1
Timestamp of tree: Mon, 21 Nov 2011 06:00:01 +0000
ccache version 3.1.3 [enabled]
app-shells/bash:          4.2_p10
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.6.7-r2, 2.7.2-r3, 3.1.4-r3, 3.2.2
dev-util/ccache:          3.1.3
dev-util/cmake:           2.8.6-r3
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1
sys-apps/openrc:          0.9.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.5-r1, 1.6.3-r1, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1-r1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.4.6-r1, 4.5.3-r1, 4.6.2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 2.6.39 (virtual/os-headers)
sys-libs/glibc:           2.13-r4
Repositories: gentoo sunrise x11 proaudio desktop-effects multimedia kde-sunset games roslin dev-zero lxde stuge wolf31o2 pd-overlay moshbear-patched
Installed sets: 
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-O2 -pipe -march=core2 -ggdb"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /usr/share/gnupg/qualified.txt /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.3/ext-active/ /etc/php/apache2-php5.4/ext-active/ /etc/php/cgi-php5.3/ext-active/ /etc/php/cgi-php5.4/ext-active/ /etc/php/cli-php5.3/ext-active/ /etc/php/cli-php5.4/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=core2 -ggdb"
FEATURES="assume-digests binpkg-logs ccache distlocks ebuild-locks fixlafiles news nostrip parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en ru"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTDIR_OVERLAY="/var/lib/layman/sunrise /var/lib/layman/x11 /var/lib/layman/pro-audio /var/lib/layman/desktop-effects /var/lib/layman/multimedia /var/lib/layman/kde-sunset /var/lib/layman/games /var/lib/layman/roslin /var/lib/layman/dev-zero /var/lib/layman/lxde /var/lib/layman/stuge /var/lib/layman/wolf31o2 /var/lib/layman/pd-overlay /var/lib/layman/moshbear-patched"
USE="3ds X a52 aac aalib acl acpi ads aften allegro alsa amd64 amr ao apache2 api aspell audio audiofile automap autotrace avahi bash-completion bcel bcmath bdf berkdb bidi binary-drivers bineditor blas blender blender-game bluetooth branding bzip2 cairo canna caps catalogs cdda cddax cddb cdparanoia cdr cdsound cg cgi chm cjk cleartype cli client clucene cmake colordiff connection-sharing consolekit context contrib cracklib crypt cscope csharp css ctype ctypes-python cuda cups curl curlwrappers cvs cxx cyrillic dbus dc1394 detex dga dhclient dhcp dhcpcd dia dirac directfb discouraged djbfft djvu doc double-precision drawing drawspaces dri dssi dts dv dvd dvdnav dvdr dvi dvi2tty dvipdfm eap-sim ebook eigen embedded-fuseiso emboss emerald emf enca encode exceptions exif expat extensions extra extras faac faad fakevim fam fame fastcgi fbcon fbcondecor fbsplash ffmpeg fftw firefox flac flatfile fltk fluidsynth fmod fontconfig fontforge foomaticdb fortran ftp fuse games gcj gcrypt gd gdbm geoip geolocation gif gimp git glib glitz gmp gnuplot gnutls google-gadgets gpg gphoto2 gpm grammar graphics graphviz gs gsl gsm gstreamer gtk hddtemp hdri http-cache httpd iconv icotools icoutils icu id3 id3tag idea idn ieee1394 image imagemagick imap imlib inexact inline inline-init-failopen int64 ipv6 irc jabber jack jadetex jai java java6 javascript jbig jfs jmf joystick jpeg jpeg2k juju kde kerberos kpathsea ladspa lame lapack laptop lash latex lcdfilter lcms ldap lensfun libass libcaca libev libmms libnotify libsamplerate libssh2 libtiger libtommath libv4l libv4l2 libwww live lm_sensors lock logrotate logviewer loop-aes lqr lua lzma lzo m17n-lib mac mad maps math mathml matroska mbox mdi mdnsresponder-compat melt memcache memlimit mercurial mhash midi mime mixer mjpeg mmap mmx mng modplug modules mono moonlight mp3 mp4 mpd mpeg mpi mplayer msn mtp mudflap multicall multilib multimedia musepack music mysql nas nat ncurses net netbeans netpbm network-cron networkmanager nfs nls nmap nntp nowin nptl nptlonly nsplugin nss ntfs ntlm numpy octave offensive ogg openal openexr opengl openmp openssl opensslcrypt optimization pam pango parse-clocks pcf pch pcntl pcre pdf perl phonon php pidgin plasma player plotutils plugins pmu png policykit pop posix postgres postproc ppds pppd private-headers ps pstoedit pstricks pulseaudio python python-bindings qt-dbus qt3 qt3support qt4 quicktime raw rawio readline realtime recode recommended recording regex reiserfs resolvconf rfc3779 rfc822 rle rrdcgi rrdtool rss rtf rtsp rubberband ruby samba scanner schroedinger science script sdk sdl sdl-image sdl-sound sdlaudio semantic-desktop sensord server servletapi session sftp shm shorten smime smp sms smtp sndfile sox speex spell sql sqlite sqlite3 srt sse sse2 ssl startup-notification stats status stlport stream strong-optimization subtitles subversion suid svg svgz swig sysfs syslog t1lib taglib tcl tcpd tex tex4ht text textures theora threads thunderbird tidy tiff timezone tk tokenizer tokyocabinet tomsfastmath toolame toolbar tools trace transcode truetype truetype-debugger twolame udev udev-acl udis86 udisks unicode unsupported unzip upnp upower urlpicpreview usb utils uuid v4l v4l2 vcd vcdinfo vcdx vdpau video videos vim vim-pager vim-syntax vistafree vix vmware-tools vorbis vst wav wavpack webkit wifi winetools winetriks wireshark wma wmf wordperfect wps wxwidgets x264 xanim xattr xcb xcomposite xetex xft xinerama xml xmlreader xmlrpc xmlwriter xmp xorg xosd xpfast xpm xscreensaver xulrunner xv xvid xvmc youtube zeroconf zip zlib zsh-completion" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en ru" NETBEANS_MODULES="*" NGINX_MODULES_HTTP="*" PHP_TARGETS="php5-3" RUBY_TARGETS="jruby ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Comment 1 Andrey Vul 2011-11-21 19:10:55 UTC
Even as of gcc-4.6, libstdc++ doesn't have move semantics in std::basic_ifstream<_CharT, _Traits>. Hence, this bug is unfixable.