c++: Add fixed test [PR82239]
authorMarek Polacek <polacek@redhat.com>
Tue, 20 Oct 2020 14:15:41 +0000 (10:15 -0400)
committerMarek Polacek <polacek@redhat.com>
Tue, 20 Oct 2020 14:16:12 +0000 (10:16 -0400)
This test was fixed by r256550 but that commit was fixing another issue,
and just happened to fix this too.

gcc/testsuite/ChangeLog:

PR c++/82239
* g++.dg/cpp0x/static_assert16.C: New test.

gcc/testsuite/g++.dg/cpp0x/static_assert16.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.dg/cpp0x/static_assert16.C b/gcc/testsuite/g++.dg/cpp0x/static_assert16.C
new file mode 100644 (file)
index 0000000..5b40b77
--- /dev/null
@@ -0,0 +1,14 @@
+// PR c++/82239
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct C {
+   static constexpr int x = 5;
+   void f()
+   {
+      static_assert(0 < x, "");
+      static_assert(0 < (x), "");
+      static_assert(true || (0 < x), "");
+      static_assert(true || (0 < (x)), "");
+   }
+};