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

            Bug ID: 115783
           Summary: GCC accepts invalid program involving calling explicit
                    object member function from static member function
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jlame646 at gmail dot com
  Target Milestone: ---

The following program is accepted by gcc but rejected by clang and msvc. Demo:
https://godbolt.org/z/4Gnf955e6

```
struct C  
{
  void f(this C self);  
  static void g() 
  {
       C::f();      //#1: gcc accepts but clang and msvc rejects
    // (C::f)();    //#2: all three compilers rejects

  }
};
int main()
{ 

}
```

As you can see in the demo, gcc accepts `#1`.

Reply via email to