summaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-25 18:04:27 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2017-07-25 18:04:27 +0000
commitba7b369373cb47ce7a549248a3cfecf516a92a8b (patch)
treebebb443ef5c546add5433f803c7f4ba756617837 /libstdc++-v3/testsuite
parent1890a6f44450d413c08caf16ece942b5b9cd1257 (diff)
PR libstdc++/80737 backport std::variant fix from mainline
Backport from mainline 2017-05-20 Tim Shen <timshen@google.com> PR libstdc++/80737 * include/std/variant(variant::variant): SFINAE on is_same first. * testsuite/20_util/variant/any.cc: test case. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250532 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite')
-rw-r--r--libstdc++-v3/testsuite/20_util/variant/any.cc31
1 files changed, 31 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/20_util/variant/any.cc b/libstdc++-v3/testsuite/20_util/variant/any.cc
new file mode 100644
index 000000000000..5811d0f055ec
--- /dev/null
+++ b/libstdc++-v3/testsuite/20_util/variant/any.cc
@@ -0,0 +1,31 @@
+// { dg-options "-std=gnu++17" }
+// { dg-do compile }
+
+// Copyright (C) 2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+#include <any>
+#include <variant>
+
+struct A { std::variant<std::any> a; };
+
+void Bar(const A&);
+
+void Foo() {
+ A a;
+ Bar(a);
+}