https://bugs.kde.org/show_bug.cgi?id=375282

            Bug ID: 375282
           Summary: Method return type inside template is unknown
           Product: kdevelop
           Version: 5.1.0
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: Language Support: CPP (Clang-based)
          Assignee: kdevelop-bugs-n...@kde.org
          Reporter: nicolas.alva...@gmail.com
  Target Milestone: ---

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.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to