I was curious if our auto(x) works in contexts like bit-field width and similar. It appears that it does. Might be worth adding a test for it.
Tested x86_64-pc-linux-gnu, applying to trunk. gcc/testsuite/ChangeLog: * g++.dg/cpp23/auto-fncast10.C: New test. --- gcc/testsuite/g++.dg/cpp23/auto-fncast10.C | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp23/auto-fncast10.C diff --git a/gcc/testsuite/g++.dg/cpp23/auto-fncast10.C b/gcc/testsuite/g++.dg/cpp23/auto-fncast10.C new file mode 100644 index 00000000000..29c779b2cb4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp23/auto-fncast10.C @@ -0,0 +1,18 @@ +// { dg-do compile { target c++23 } } + +struct S { + int i1 : auto(12); + int i2 : auto{12}; + static constexpr auto x = auto(12); + static constexpr auto y = auto{12}; +}; + +struct R { + int i; +}; + +static constexpr R r1 = { auto(23) }; +static constexpr R r2 = { auto{23} }; +enum E { X = auto(12), Y = auto{1u} }; +static_assert (auto(true)); +static_assert (auto{true}); base-commit: 982a2c9b7866558039df61b0596caad57c94c8c4 -- 2.33.1