Bug 375282 - Method return type inside template is unknown
Summary: Method return type inside template is unknown
Status: RESOLVED WORKSFORME
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (Clang-based) (show other bugs)
Version: 5.1.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-19 07:09 UTC by Nicolás Alvarez
Modified: 2022-12-18 05:15 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Alvarez 2017-01-19 07:09:38 UTC
struct Question {
    int answer();
};

template<typename T>
struct Foo {
    Question* question();

    int fortyTwo() {
        auto x = question();
        return x->answer();
    }
};

If I have a class template with a method ('fortyTwo') calling another ('question'), the tooltip on 'question' shows the correct type, but it seems the type of the function call as an expression is unknown. Therefore, the type of 'x' is unknown (tooltip says 'auto'), and 'answer' is not highlighted (remains black). This only happens if Foo is a template, but happens even if nothing in the class actually depends on T (as in the example).

"return question()->answer();" shows the same problem, but with "auto" it's clearer that the problem is the type of the returned value.

An example of real-world code showing this problem is KDevelop::AbstractContextBuilder<T>::topContext(). It returns "currentContext()->topContext();", and the 'topContext' there is not highlighted.

I'm using libclang 3.8.1.
Comment 1 KiloAlphaIndia 2017-03-24 09:43:41 UTC
I can confirm this. Using clang master.
Comment 2 Justin Zobel 2022-11-03 01:40:08 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 3 Bug Janitor Service 2022-11-18 05:15:18 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 4 KiloAlphaIndia 2022-11-18 08:32:51 UTC
In VS-Code I also get `x` as type `auto` so it's probably a clang indexer issue.
Comment 5 Bug Janitor Service 2022-12-03 05:17:21 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 6 Bug Janitor Service 2022-12-18 05:15:28 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!