diff options
author | Marek Polacek <polacek@redhat.com> | 2021-12-10 13:07:19 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2021-12-10 13:09:13 -0500 |
commit | 0df964ba2875063bb14ddd9d55fec5b1e862c90b (patch) | |
tree | e44fc4bfe4ecf51535f3f6f404a7663b3adb7212 | |
parent | bb6a1ebb8585b85879735d0d6df9535885fad165 (diff) | |
download | gcc-0df964ba2875063bb14ddd9d55fec5b1e862c90b.zip gcc-0df964ba2875063bb14ddd9d55fec5b1e862c90b.tar.gz gcc-0df964ba2875063bb14ddd9d55fec5b1e862c90b.tar.bz2 |
c++: Add test for C++23 auto(x)
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.
gcc/testsuite/ChangeLog:
* g++.dg/cpp23/auto-fncast10.C: New test.
-rw-r--r-- | gcc/testsuite/g++.dg/cpp23/auto-fncast10.C | 18 |
1 files changed, 18 insertions, 0 deletions
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 0000000..29c779b --- /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}); |