The following is invalid C++ and should be rejected:
struct Thing {
  Thing(){}
};

int f (int i)
{
  switch (i)
  {
  case 1:
    Thing *str = new Thing;
  case 2:
  case 3:
    ;
  }
  return 0;
}

Previous versions before 4.0.0 rejected with the following message:
t.cc:11: error: jump to case label
t.cc:10: error:   crosses initialization of `Thing*str'
t.cc:12: error: jump to case label
t.cc:10: error:   crosses initialization of `Thing*str'

-- 
           Summary: [4.0/4.1 Regression] crosses initialization of a pointer
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to