diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml index 0f32827952f..a22cef063f3 100644 --- a/.cirrus.tasks.yml +++ b/.cirrus.tasks.yml @@ -782,6 +782,7 @@ task: CIRRUS_WINDOWS_ERROR_MODE: 0x8001 MESON_FEATURES: + -Dcpp_args=/std:c++20 -Dauto_features=disabled -Dldap=enabled -Dssl=openssl diff --git a/meson.build b/meson.build index c4b4cd4af06..8b134b28a69 100644 --- a/meson.build +++ b/meson.build @@ -2176,6 +2176,20 @@ choke me endif +# Check whether the C++ compiler supports designated initializers. +# These are used by PG_MODULE_MAGIC, and we use the result of this +# test to decide whether to enable the test_cplusplusext test module. +# Designated initializers only got standardized in C++20. In GCC and +# Clang they also work when using earlier C++ versions, but MSVC +# really only supports them when its configured to be in C++20 mode or +# higher. +if have_cxx + have_cxx_desinit = cxx.compiles('struct S { int x; } s = { .x = 1 };', name: 'C++ designated initializers') +else + have_cxx_desinit = false +endif + + ############################################################### # Compiler flags diff --git a/src/test/modules/test_cplusplusext/meson.build b/src/test/modules/test_cplusplusext/meson.build index d13210ca593..5860464a503 100644 --- a/src/test/modules/test_cplusplusext/meson.build +++ b/src/test/modules/test_cplusplusext/meson.build @@ -1,11 +1,6 @@ # Copyright (c) 2025-2026, PostgreSQL Global Development Group -if not have_cxx - subdir_done() -endif - -# Currently not supported, to be fixed. -if cc.get_id() == 'msvc' +if not have_cxx or not have_cxx_desinit subdir_done() endif