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

            Bug ID: 111841
           Summary: Lookup context rejected at definition if lookup finds
                    a namespace
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See <https://compiler-explorer.com/z/K8afMEbsr>.

```C++
namespace ns { }
struct X {
  struct ns { void f(); };
  struct t : ns { };
};
void g() {
  [](auto x) {
      return x.ns::f();
  }
  // (X::t{}) // Clang and MSVC accept.
  ;
}
```

```output
<source>: In lambda function:
<source>:8:16: error: 'ns::f' is not a class member
    8 |       return x.ns::f();
      |                ^~
Compiler returned: 1
```

This goes back to GCC 4.9.4: <https://compiler-explorer.com/z/17bxK94rT>.

Reply via email to