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=35967&action=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.

Reply via email to