Constructor usage not detected when called via emplace_back(...)

Answered

When using Find Usages on a class constructor in Rider , calls to the constructor via std::vector::emplace_back(...) are not shown.

 

struct MyType {
   MyType(int a, float b, std::string c);
};
std::vector<MyType> vec;
vec.emplace_back(1, 2.0f, "test");  // this line is NOT shown in "Find Usages" of MyType::MyType(int, float, std::string)

 

When using "Find Usages" on a constructor, I expect usages like emplace_back(...) (which directly forward arguments to that constructor) to appear in the results.

0
3 comments

Hello!

  1. Do you experience this in Rider or in CLion?
  2. Is vec.emplace_back(1, 2.0f, "test"); located in the same file as the definitions of MyType and vec or not?
0

1. in CLion

2. not in same file

 

0

Here is the related issue - RSCPP-32660. Feel free to comment or upvote it in order to get updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

0

Please sign in to leave a comment.