]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libstdc++-v3/testsuite/20_util/any/misc/any_cast_neg.cc
Update copyright years.
[thirdparty/gcc.git] / libstdc++-v3 / testsuite / 20_util / any / misc / any_cast_neg.cc
index 43c6c6b4a26ae91321177425b7840cd3424ede49..6a271e8faabb8f72406d474fbd6213c1a50f91f5 100644 (file)
@@ -1,7 +1,7 @@
 // { dg-options "-std=gnu++17" }
 // { dg-do compile }
 
-// Copyright (C) 2014-2016 Free Software Foundation, Inc.
+// Copyright (C) 2014-2020 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
 
 #include <any>
 
+using std::any;
+using std::any_cast;
+
 void test01()
 {
-  using std::any;
-  using std::any_cast;
-
   const any y(1);
-  any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 357 }
+  any_cast<int&>(y); // { dg-error "invalid 'static_cast'" "" { target { *-*-* } } 461 }
+  // { dg-error "Template argument must be constructible from a const value" "" { target { *-*-* } } 457 }
+}
+
+void test02()
+{
+  any y(1);
+  any_cast<int&&>(y);
+  // { dg-error "Template argument must be constructible from an lvalue" "" { target { *-*-* } } 483 }
+}
+
+void test03()
+{
+  any y(1);
+  any_cast<int&>(std::move(y));  // { dg-error "invalid 'static_cast'" "" { target { *-*-* } } 501 }
+  // { dg-error "Template argument must be constructible from an rvalue" "" { target { *-*-* } } 497 }
 }