Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bogus function overload error using enum from class #54746

Open
urnathan opened this issue Apr 5, 2022 · 2 comments
Open

bogus function overload error using enum from class #54746

urnathan opened this issue Apr 5, 2022 · 2 comments
Assignees
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"

Comments

@urnathan
Copy link
Contributor

urnathan commented Apr 5, 2022

struct S {
  enum M { Mask = 1 };
};

void Frob () {
  using enum S::M;
  void (~(Mask));
}

build/bin/clang "-cc1" "-triple" "x86_64-redhat-linux-gnu" "-emit-obj" -std=c++20 using-enum.ii

using-enum.ii:7:10: error: reference to overloaded function could not be resolved; did you mean to call it?
  void (~(Mask));
         ^~~~~~
using-enum.ii:2:12: note: possible target for call
  enum M { Mask = 1 };
           ^
1 error generated.

guess I missed something with 'using enum'

@urnathan urnathan self-assigned this Apr 5, 2022
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" and removed new issue labels Apr 5, 2022
@llvmbot
Copy link
Collaborator

llvmbot commented Apr 5, 2022

@llvm/issue-subscribers-clang-frontend

@shafik
Copy link
Collaborator

shafik commented Nov 29, 2022

shafik added a commit that referenced this issue Nov 29, 2022
… as NonType when they are brought into scope via using enum

Currently Sema::ClassifyName(...) in some cases when an enumerator is brought
into scope via using enum during lookup it can end up being classified as an
OverloadSet. It looks like this was never accounted for when using enum support
was implemented and we need to add a check to allow an EnumConstantDecl to be
classified as NonType even when it is a class member.

This fixes:
  #58057
  #59014
  #54746

Differential Revision: https://reviews.llvm.org/D138091
CarlosAlbertoEnciso pushed a commit to SNSystems/llvm-debuginfo-analyzer that referenced this issue Nov 30, 2022
… as NonType when they are brought into scope via using enum

Currently Sema::ClassifyName(...) in some cases when an enumerator is brought
into scope via using enum during lookup it can end up being classified as an
OverloadSet. It looks like this was never accounted for when using enum support
was implemented and we need to add a check to allow an EnumConstantDecl to be
classified as NonType even when it is a class member.

This fixes:
  llvm/llvm-project#58057
  llvm/llvm-project#59014
  llvm/llvm-project#54746

Differential Revision: https://reviews.llvm.org/D138091
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema"
Projects
None yet
Development

No branches or pull requests

4 participants