Details
-
Bug
-
Resolution: Incomplete
-
Not Evaluated
-
None
-
Qt Creator 4.9.2, Qt Creator 4.10.0-rc1
-
None
Description
The latest versions of Qt Creator 4.9.2 and 4.10.0-rc1 seem to skip the body of template functions under certain conditions.
Very simple example:
#include <iostream> template<class T> void test(int a) { std::cout << a << '\n'; }
I would expect that the body of the function is properly syntax highlighted.
But QtCreator with the Clang based code model does not highlight the body of the test function, see screenshot:
This at first seemed like a limitation of clangbackend, but there are some strange workarounds:
- When the function uses a deduced return type, everything works as expected.
- When the function is instantiated in the same file, it also works:
My wild speculation is, that clang tries to be lazy here and skips the body of template functions as long as possible. The deduced return type workaround might be a bug to that optimization. But for our syntax highlighting needs, we need to trigger the template function body parsing.
I hope someone with more knowledge about clang can create a patch for that, because it's really annoying to write code without any code model.