[libcxx-commits] [PATCH] D61033: [libc++][test] Fix noexcept assertions in variant's get tests
Casey Carter via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 23 11:40:48 PDT 2019
CaseyCarter created this revision.
CaseyCarter added reviewers: mclow.lists, EricWF, ldionne.
Herald added subscribers: arphaman, dexonsmith.
All constant expressions are non-potentially-throwing in C++14, but that is *not* the case in C++17. I've switched the conditional on these checks from "if not clang" to "if not GCC", since GCC doesn't yet implement the C++17 rules per the bug noted in the source comment.
Repository:
rCXX libc++
https://reviews.llvm.org/D61033
Files:
test/std/utilities/variant/variant.get/get_index.pass.cpp
test/std/utilities/variant/variant.get/get_type.pass.cpp
Index: test/std/utilities/variant/variant.get/get_type.pass.cpp
===================================================================
--- test/std/utilities/variant/variant.get/get_type.pass.cpp
+++ test/std/utilities/variant/variant.get/get_type.pass.cpp
@@ -37,8 +37,8 @@
{
using V = std::variant<int, const long>;
constexpr V v(42);
-#ifndef __clang__ // Avoid https://bugs.llvm.org/show_bug.cgi?id=15481
- ASSERT_NOEXCEPT(std::get<int>(v));
+#if !defined(__GNUC__) || defined(__clang__) // Avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86044
+ ASSERT_NOT_NOEXCEPT(std::get<int>(v));
#endif
ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
static_assert(std::get<int>(v) == 42, "");
@@ -53,8 +53,8 @@
{
using V = std::variant<int, const long>;
constexpr V v(42l);
-#ifndef __clang__ // Avoid https://bugs.llvm.org/show_bug.cgi?id=15481
- ASSERT_NOEXCEPT(std::get<const long>(v));
+#if !defined(__GNUC__) || defined(__clang__) // Avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86044
+ ASSERT_NOT_NOEXCEPT(std::get<const long>(v));
#endif
ASSERT_SAME_TYPE(decltype(std::get<const long>(v)), const long &);
static_assert(std::get<const long>(v) == 42, "");
Index: test/std/utilities/variant/variant.get/get_index.pass.cpp
===================================================================
--- test/std/utilities/variant/variant.get/get_index.pass.cpp
+++ test/std/utilities/variant/variant.get/get_index.pass.cpp
@@ -43,8 +43,8 @@
{
using V = std::variant<int, const long>;
constexpr V v(42);
-#ifndef __clang__ // Avoid https://bugs.llvm.org/show_bug.cgi?id=15481
- ASSERT_NOEXCEPT(std::get<0>(v));
+#if !defined(__GNUC__) || defined(__clang__) // Avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86044
+ ASSERT_NOT_NOEXCEPT(std::get<0>(v));
#endif
ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &);
static_assert(std::get<0>(v) == 42, "");
@@ -59,8 +59,8 @@
{
using V = std::variant<int, const long>;
constexpr V v(42l);
-#ifndef __clang__ // Avoid https://bugs.llvm.org/show_bug.cgi?id=15481
- ASSERT_NOEXCEPT(std::get<1>(v));
+#if !defined(__GNUC__) || defined(__clang__) // Avoid https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86044
+ ASSERT_NOT_NOEXCEPT(std::get<0>(v));
#endif
ASSERT_SAME_TYPE(decltype(std::get<1>(v)), const long &);
static_assert(std::get<1>(v) == 42, "");
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61033.196292.patch
Type: text/x-patch
Size: 2425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190423/8e08b1a2/attachment.bin>
More information about the libcxx-commits
mailing list