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

            Bug ID: 117761
           Summary: Incorrect name lookup within decltype used as part of
                    an id-expression for a class member access
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luigighiron at gmail dot com
  Target Milestone: ---

GCC incorrectly handles name lookup within decltypes in locations such as the
following:

struct{int x;}x;
int main(){
    x.decltype(x)::x=42;
}

Here, the x in decltype(x) should refer to the structure x and not the member
x. GCC however decides to do member lookup same as it would outside of decltype
and finds the member x, which then results in GCC emitting an error because of
trying to access a member named x in the type int. Clang and MSVC both accept
this code.

Reply via email to