[Bug c++/41039] New: Member reordering rule is overly strict

coppro at users dot sf dot net gcc-bugzilla@gcc.gnu.org
Wed Aug 12 04:21:00 GMT 2009


The check for declarations that could, if reordered within a class, alter the
meaning of that class (and thus be ill-formed) is overly restrictive.
Specifically, it bans any declaration that might cause such an issue, while a
program is ill-formed only if the reordering would actually cause an ambiguity.

The following is not valid

struct foo { };
struct bar {
  foo f;
  foo foo();
}

because if you rearrange the definitions within bar, the program's meaning
might change.

The following, however, is

struct foo { };
struct bar {
  foo foo();
}

because there is nothing to reorder, so the meaning of bar cannot possibly
change.


-- 
           Summary: Member reordering rule is overly strict
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: coppro at users dot sf dot net


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



More information about the Gcc-bugs mailing list