public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/ieee)] c++: Add test for PR 93901.
@ 2020-03-18 17:20 Michael Meissner
  0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2020-03-18 17:20 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:57e7ad5a8fd5a7bddf15e2fede6d2546cc6a2797

commit 57e7ad5a8fd5a7bddf15e2fede6d2546cc6a2797
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Mar 16 21:16:35 2020 -0400

    c++: Add test for PR 93901.

Diff:
---
 gcc/testsuite/g++.dg/cpp0x/noexcept57.C | 40 +++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept57.C b/gcc/testsuite/g++.dg/cpp0x/noexcept57.C
new file mode 100644
index 00000000000..aca98912701
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept57.C
@@ -0,0 +1,40 @@
+// PR c++/93901
+// { dg-do compile { target c++11 } }
+
+void *operator new (__SIZE_TYPE__, void *p) noexcept { return p; }
+
+extern void *mem;
+
+constexpr bool YES = true;
+
+struct NoexceptTrueCtor {
+	NoexceptTrueCtor() noexcept(true);
+};
+void NoexceptTrueFun() noexcept(true);
+
+struct NoexceptYesCtor {
+	NoexceptYesCtor() noexcept(YES);
+};
+void NoexceptYesFun() noexcept(YES);
+
+struct NoexceptOneEqOneCtor {
+	NoexceptOneEqOneCtor() noexcept(1 == 1);
+};
+void NoexceptOneEqOneFun() noexcept(1 == 1);
+
+struct NoNoexceptCtor {
+	NoNoexceptCtor();
+};
+void NoNoexceptFun();
+
+static_assert(noexcept(new(mem) NoexceptTrueCtor), "2"); // OK
+static_assert(noexcept(NoexceptTrueFun()), "3"); // OK
+
+static_assert(noexcept(new(mem) NoexceptYesCtor), "5"); // fail
+static_assert(noexcept(NoexceptYesFun()), "6"); // OK
+
+static_assert(noexcept(new(mem) NoexceptOneEqOneCtor), "8"); // fail
+static_assert(noexcept(NoexceptOneEqOneFun()), "9"); // OK
+
+static_assert(!noexcept(new(mem) NoNoexceptCtor), "11"); // OK
+static_assert(!noexcept(NoNoexceptFun()), "12"); // OK


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

only message in thread, other threads:[~2020-03-18 17:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-18 17:20 [gcc(refs/users/meissner/heads/ieee)] c++: Add test for PR 93901 Michael Meissner

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).