https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121228

            Bug ID: 121228
           Summary: -fno-access-control doesn't work with structured
                    bindings
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luigighiron at gmail dot com
  Target Milestone: ---

The following is a program that uses structured bindings to access a private
member:

class A{int x;};
int main(){
    auto[x]=A();
}

-fno-access-control is supposed to bypass access checks, but with structured
bindings it doesn't seem to have any effect. Replacing class with struct makes
this work, with and without -fno-access-control.

Reply via email to