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

            Bug ID: 92169
           Summary: crash on referring to a local class member by
                    unqualified name from outside the enclosing function
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk
  Target Milestone: ---

[Probably no-one will ever write code like this outside a compiler test case,
but filing just in case this affects non-contrived situations.]

This code crashes every version of g++ that supports deduced return types:


auto f() {
    static int n;
    struct Y {
        static int &g() { return n; }
        struct X {
            int &get();
        };
    };
    return Y::X();
};
using X = decltype(f());
int &X::get() { return g(); }

Reply via email to