public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-5901] c++: Add test for C++23 auto(x)
@ 2021-12-10 18:09 Marek Polacek
  0 siblings, 0 replies; only message in thread
From: Marek Polacek @ 2021-12-10 18:09 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:0df964ba2875063bb14ddd9d55fec5b1e862c90b

commit r12-5901-g0df964ba2875063bb14ddd9d55fec5b1e862c90b
Author: Marek Polacek <polacek@redhat.com>
Date:   Fri Dec 10 13:07:19 2021 -0500

    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.

Diff:
---
 gcc/testsuite/g++.dg/cpp23/auto-fncast10.C | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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});


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-12-10 18:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-10 18:09 [gcc r12-5901] c++: Add test for C++23 auto(x) Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).