Open ec04fc15-fa35-46f2-80e1-5d271f2ef708 opened 8 years ago
@llvm/issue-subscribers-c-1
The issue still reproduces as of Clang 16: https://godbolt.org/z/TEMqxrhxn
@llvm/issue-subscribers-clang-frontend
Confirming as the example in the summary is a bug, but this behavior for LookupSingleName
is the documented behavior for it: https://github.com/llvm/llvm-project/blob/2cbc265cc947c40372b841f80649276fbf9d183f/clang/include/clang/Sema/Sema.h#L4465
Extended Description
LookupSingleName does something very odd: if lookup finds an overload set of functions, it acts exactly like lookup found nothing. This results in almost every single caller of this function doing the wrong thing in that case (ranging from misdiagnosing problems to accepting invalid code). Example:
int m(); enum { m }; // error int n(); int n(int); enum { n }; // accepted!