[Bug c++/66857] Reference not bound to lvalue

2015-07-13 Thread sebastian.lauwers at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

--- Comment #1 from Sebastian Lauwers sebastian.lauwers at gmail dot com ---
Command: g++ -v -save-temps test.cpp

Output:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--disable-libgcj --with-default-libstdcxx-abi=c++98 --with-isl --enable-libmpx
--enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 5.1.1 20150618 (Red Hat 5.1.1-4) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/cc1plus -E -quiet -v -D_GNU_SOURCE
test.cpp -mtune=generic -march=x86-64 -fpch-preprocess -o test.ii
ignoring nonexistent directory
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/include-fixed
ignoring nonexistent directory
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../x86_64-redhat-linux/include
#include ... search starts here:
#include ... search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../include/c++/5.1.1

/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../include/c++/5.1.1/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../include/c++/5.1.1/backward
 /usr/lib/gcc/x86_64-redhat-linux/5.1.1/include
 /usr/local/include
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/cc1plus -fpreprocessed test.ii
-quiet -dumpbase test.cpp -mtune=generic -march=x86-64 -auxbase test -version
-o test.s
GNU C++ (GCC) version 5.1.1 20150618 (Red Hat 5.1.1-4) (x86_64-redhat-linux)
compiled by GNU C version 5.1.1 20150618 (Red Hat 5.1.1-4), GMP version
6.0.0, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++ (GCC) version 5.1.1 20150618 (Red Hat 5.1.1-4) (x86_64-redhat-linux)
compiled by GNU C version 5.1.1 20150618 (Red Hat 5.1.1-4), GMP version
6.0.0, MPFR version 3.1.2, MPC version 1.0.2
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: a5de1e39a9a4df73d4ab91471f1f5942
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 as -v --64 -o test.o test.s
GNU assembler version 2.25 (x86_64-redhat-linux) using BFD version version
2.25-8.fc22
COMPILER_PATH=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/:/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/:/usr/lib/gcc/x86_64-redhat-linux/
LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/5.1.1/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/5.1.1/collect2 -plugin
/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/liblto_plugin.so
-plugin-opt=/usr/libexec/gcc/x86_64-redhat-linux/5.1.1/lto-wrapper
-plugin-opt=-fresolution=test.res -plugin-opt=-pass-through=-lgcc_s
-plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lc
-plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lgcc --build-id
--no-add-needed --eh-frame-hdr --hash-style=gnu -m elf_x86_64 -dynamic-linker
/lib64/ld-linux-x86-64.so.2
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crt1.o
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crti.o
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtbegin.o
-L/usr/lib/gcc/x86_64-redhat-linux/5.1.1
-L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64 -L/lib/../lib64
-L/usr/lib/../lib64 -L/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../.. test.o
-lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/crtend.o
/usr/lib/gcc/x86_64-redhat-linux/5.1.1/../../../../lib64/crtn.o


[Bug c++/66857] New: Reference not bound to lvalue

2015-07-13 Thread sebastian.lauwers at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66857

Bug ID: 66857
   Summary: Reference not bound to lvalue
   Product: gcc
   Version: 5.1.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: sebastian.lauwers at gmail dot com
  Target Milestone: ---

Created attachment 35967
  -- https://gcc.gnu.org/bugzilla/attachment.cgi?id=35967action=edit
preprocessed code

Reporting this as it seems to be a regression from gcc 4.9.2. The following
code works on gcc 4.9.2, but asserts on gcc 5.1.1:

=== 8 ==
#include cassert

const int i = 0;

struct Test {
Test(const int rhs) {
assert(rhs == i);
}
};

int main(void) {
Test test = i;
}
=== 8 ==

If line 12 is changed to:

Test test(i);

The assertion is not triggered.

Please let me know if further information is required.