llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28k stars 11.56k forks source link

almost all calls to LookupSingleName are wrong #25925

Open ec04fc15-fa35-46f2-80e1-5d271f2ef708 opened 8 years ago

ec04fc15-fa35-46f2-80e1-5d271f2ef708 commented 8 years ago
Bugzilla Link 25551
Version trunk
OS Linux
CC @riccibruno

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!

llvmbot commented 1 year ago

@llvm/issue-subscribers-c-1

AaronBallman commented 1 year ago

The issue still reproduces as of Clang 16: https://godbolt.org/z/TEMqxrhxn

llvmbot commented 1 year ago

@llvm/issue-subscribers-clang-frontend

AaronBallman commented 1 year ago

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