Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
Qt Creator 7.0.0-beta1
-
None
-
Kubuntu 21.10 x86_64
Description
With QtCreator 7.0.0 beta 1 (with clangd enabled by default) I'm seeing some C++ code coloring and formatting issues that were not present in 6.0.2 (with clangd disabled). Consider the following piece of code:
#include <atomic> #include <boost/intrusive/options.hpp> #include <boost/intrusive/list.hpp> #include <boost/intrusive/list_hook.hpp> typedef boost::intrusive::list_base_hook< boost::intrusive::tag< struct for_bar_list >, boost::intrusive::link_mode< boost::intrusive::safe_link > > bar_list_hook; struct bar : public bar_list_hook { void bar_func(); }; struct foo { //! The list of send requests typedef boost::intrusive::list< bar, boost::intrusive::base_hook< bar_list_hook >, boost::intrusive::constant_time_size< false > > bar_list; enum my_enum { value1, value2 }; std::atomic< int > n; int m; bar_list bl; foo(bar* p) : n(1), m(2) { if (p != nullptr) { bl.empty(); bl.push_back(*p); p->bar_func(); } } };
See the attached screenshot to see how it is rendered in QtCreator. In this code:
1. The enum type `my_enum` is colored as an enum value (purple), not as a type (blue).
2. `n` in the `foo` constructor's initializer list is italic for some reason. `m` is not, as expected.
3. `false` in `bar_list` definition and `nullptr` are not colored as keywords (blue) and instead are colored grey (as generic text? string literal? not sure). I'll note that `nullptr` is colored blue immediately after being typed, but then turns grey after some delay. `true` and `false` are also colored blue in other contexts.
In a larger code base I've seen other weirdness, such as object names rendered italic in various unexpected contexts (e.g. in `vec.push_back(obj)` `vec` would be italic), but I couldn't reproduce it in a small test project. The only two contexts where the italic font is configured for C++ code are "Virtual Function" and "Output Argument", and the problematic contexts are none of that.