[all-commits] [llvm/llvm-project] 486644: [Clang] Fix name lookup for dependent bases (#114978)

Vladislav Belov via All-commits all-commits at lists.llvm.org
Tue Nov 26 03:57:09 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 486644723038555a224fd09d462bb5099e64809e
      https://github.com/llvm/llvm-project/commit/486644723038555a224fd09d462bb5099e64809e
  Author: Vladislav Belov <vladislav.belov at syntacore.com>
  Date:   2024-11-26 (Tue, 26 Nov 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/AST/CXXInheritance.cpp
    M clang/test/CXX/drs/cwg5xx.cpp
    M clang/www/cxx_dr_status.html

  Log Message:
  -----------
  [Clang] Fix name lookup for dependent bases (#114978)

Currently the following example is a compilation failure: 
```cpp
template<typename T> struct A {
    typedef int M;
    struct B {
      typedef void M;
      struct C;
    };
};

template<typename T> struct A<T>::B::C : A<T> {
    M m; // void or int ?
};
```

According to the point 13.8.3.2

```
A dependent base class is a base class that is a dependent type and is not the current instantiation.
Note 2 : A base class can be the current instantiation in the case of a nested class naming an enclosing class as a base.
```

The base class `A` is the current instantiation, because `C` is a nested
class for an enclosing class `A<T>`, it's is the not-dependent base
class and we need to search the names through its scope.

This patch makes this example compile



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list