Skip to content

IntelliSense-based Go to Definition returns both const and non-const methods as results (instead of just the matching one) #3015

Closed

Description

After the fix for #3014 ships.

struct foo
{
int func() const; // These are defined in a different .cpp file.
int func();
};

int main()
{
foo f;
f.func(); // Go to def doesn't take the const-ness into account and returns both.
}

This seems too low priority to worry about currently. If anyone wants this fixed, upvote it.

Activity

  1. changed the title [-]Go to Definition returns const and non-const methods as results[/-] [+]IntelliSense-based Go to Definition returns both const and non-const methods as results (instead of just the matching one)[/+] on Jan 10, 2019
  2. michelleangela commented on Jul 14, 2021

    @michelleangela
    Contributor

    The following issue may be related. The scenario is not typical as user would not do a "go to definition" on a definition.

    Sample code:

    int func1(); // declaration
    int func1(float var1) // local param
    {
        {
            double var1 = 0; // new local scope
            return var1;
        }
        return var1 + func1();
    }
    
    int func1() // overload. Returns confirmed and non-confirmed references.
    {
        if (var1 == 0)
            return func1(0);
    }
    
    1. Do a "Go to definition" on definition of int func1(float var1)
    2. It returns two results instead of just staying at the definition.

    image

    Does it return two results because it's an overloaded function?

  3. sean-mcmanus commented on Jul 15, 2021

    @sean-mcmanus
    ContributorAuthor

    Michelle Matias (@michelleangela) I think it's doing a Find All References. I think you can change the behavior via changing editor.gotoLocation.alternativeDefinitionCommand.

  4. moved this from Triage to No status in cpptoolson Jun 20, 2024
  5. bobbrow commented on Nov 27, 2024

    @bobbrow
    Contributor

    The original issue appears to be fixed now.

  6. locked and limited conversation to collaborators on Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status
      Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions