[all-commits] [llvm/llvm-project] 485212: [Sema]Use tag name lookup for class names (#112166)
Gábor Spaits via All-commits
all-commits at lists.llvm.org
Tue Oct 15 01:19:40 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 48521209aa4d95a97564f8a5af7ccca09c6ede5d
https://github.com/llvm/llvm-project/commit/48521209aa4d95a97564f8a5af7ccca09c6ede5d
Author: Gábor Spaits <gaborspaits1 at gmail.com>
Date: 2024-10-15 (Tue, 15 Oct 2024)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/lib/Sema/SemaDecl.cpp
M clang/test/CXX/class.derived/p2.cpp
Log Message:
-----------
[Sema]Use tag name lookup for class names (#112166)
This PR would fix #16855 .
The correct lookup to use for class names is Tag name lookup,
because it does not take namespaces into account. The lookup before
does and because of this some valid programs are not accepted.
An example scenario of a valid program being declined is when you have a struct (let's call it `y`) inheriting from another struct with a name `x` but the struct `y` is in a namespace that is also called `x`:
```
struct x
{};
namespace
{
namespace x
{
struct y : x
{};
}
}
```
This shall be accepted because:
```
C++ [class.derived]p2 (wrt lookup in a base-specifier): The lookup for
// the component name of the type-name or simple-template-id is type-only.
```
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