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

go-to-definition on enum member defined in class template #296

Closed
HighCommander4 opened this issue Mar 2, 2020 · 3 comments
Closed

go-to-definition on enum member defined in class template #296

HighCommander4 opened this issue Mar 2, 2020 · 3 comments
Assignees

Comments

@HighCommander4
Copy link

HighCommander4 commented Mar 2, 2020

In the following code:

template <typename T>
struct Foo {
  enum class E { [[A]], B };
  E e = E::A^;
};

Go-to-definition at the indicated location does not take you to the definition of the enumerator A.

(The use of A is also highlighted as DependentName rather than Enumerator -- that also seems unexpected to me.)

@HighCommander4
Copy link
Author

HighCommander4 commented Mar 2, 2020

(The use of A is also highlighted as DependentName rather than Enumerator -- that also seems unexpected to me.)

This is a more general issue which I've filed as #297.

@HighCommander4
Copy link
Author

HighCommander4 commented Mar 11, 2020

(The use of A is also highlighted as DependentName rather than Enumerator -- that also seems unexpected to me.)

This is a more general issue which I've filed as #297.

That's not quite true -- unlike the example in #297, here the name A really is dependent. Consider:

template <typename T>
struct Foo {
  enum class E { [[A]], B };
  E e = E::A^;
};

template <>
enum class Foo<int>::E { H, [[A]] };

Here, there are two candidate declarations that the reference A could resolve to, depending on the value of T.

Navigation to the declaration in the primary template is still reasonable as a heuristic, but we should probably keep the color as DependentName.

@HighCommander4 HighCommander4 self-assigned this Mar 12, 2020
@HighCommander4
Copy link
Author

Proposed fix

HighCommander4 added a commit to HighCommander4/llvm-project that referenced this issue Mar 19, 2020
…merators

Fixes clangd/clangd#296

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76103
arichardson pushed a commit to arichardson/llvm-project that referenced this issue Apr 2, 2020
…merators

Fixes clangd/clangd#296

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76103
mem-frob pushed a commit to draperlaboratory/hope-llvm-project that referenced this issue Oct 7, 2022
…merators

Fixes clangd/clangd#296

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D76103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant