On 12/4/25 16:26, Frediano Ziglio wrote:
Frediano

On Thu, 4 Dec 2025 at 21:20, Nicholas Vinson <[email protected]> wrote:

On 12/4/25 16:05, Frediano Ziglio wrote:
On Thu, 4 Dec 2025 at 17:06, Nicholas Vinson <[email protected]> wrote:

Adjust designated initializer to be C++20 compliant. Starting with
g++-16, GCC will default to the C++20 standard.

Signed-off-by: Nicholas Vinson <[email protected]>
---
   server/tests/test-display-base.cpp | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/tests/test-display-base.cpp 
b/server/tests/test-display-base.cpp
index b220b7fe..5d0404c9 100644
--- a/server/tests/test-display-base.cpp
+++ b/server/tests/test-display-base.cpp
@@ -806,7 +806,7 @@ static QXLInterface display_sif = {
           .major_version = SPICE_INTERFACE_QXL_MAJOR,
           .minor_version = SPICE_INTERFACE_QXL_MINOR
       },
-    { .attached_worker = attached_worker },
+    .attached_worker = attached_worker,
       .set_compression_level = set_compression_level,
       .set_mm_time = nullptr,
       .get_init_info = get_init_info,

With this change I'm getting

    CXX      test-display-base.o
test-display-base.cpp:826:1: error: missing braces around initializer
for 'QXLInterface::<unnamed union>' [-Werror=missing-braces]
    826 | };
        | ^


Could you post your compiler version and the CXX flags you used?


*snip*

This appears to be caused because -Wmissing-braces is being explicitly set. I've tried with both gcc-15 and gcc-16, and there does not appear to be a way to suppress that warning while using designated initializers.

The original syntax triggers the error message "error: either all initializer clauses should be designated or none of them should be" when building against the C++ 20 standard.

Regards,
Nicholas Vinson


Frediano

Reply via email to