-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Feature Request
C++20 has released designated initializers which enables the initialization of data as follows:
struct Foo { int b; char a; };
Foo foo{ .b = 3, .a = 's' };Note that the initialization of designated members must be listed in declaration order (first b, then a). This is a strict error, not a warning and this behavior can only be disabled in clang (not GCC or MSVC).
The issue is that when the extension provides completion items, it will list members in alphabetical order (i.e. first a, then b in this example). This forces the user to inspect the declaration site to determine if they have the order correct (or get hit with a compiler error long after).
As for severity, this issue has a dramatic impact on usability of this feature. The example shown here is a small struct, but consider structs such as VkPhysicalDeviceFeatures with dozens upon dozens of non-alphabetized fields. In production code, big bags of data or state bits such as these are common, and having declaration-order listings of completion items would be a dramatic productivity boost.