[Bug c++/44444] New: [4.6 Regression] -Wunused-but-set-variable problem with field references

jakub at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jun 7 12:46:00 GMT 2010


struct S
{
  const int &u;
  const int &v;
  S (const int &a, const int &b) : u(a), v(b) { }
};

bool
f1 ()
{
  bool t = false;
  S z = S (1, 2);
  t |= z.u == 1;
  t |= z.v == 2;
  return t;
}

void
f2 ()
{
  S z = S (1, 2);
  z.u;
}

int i;

void
f3 ()
{
  S z = S (1, 2);
  i++, z.u;
}

warns with -Wunused when it shouldn't (except for no effect warnings).


-- 
           Summary: [4.6 Regression] -Wunused-but-set-variable problem with
                    field references
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44444



More information about the Gcc-bugs mailing list