Blame SOURCES/gcc48-pr69116.patch

003890
2016-02-10  Jonathan Wakely  <jwakely@redhat.com>
003890
003890
	PR libstdc++/69116
003890
	* include/bits/valarray_before.h (__fun, __fun_with_valarray): Only
003890
	define result_type for types which can be safely used with valarrays.
003890
	* testsuite/26_numerics/valarray/69116.cc: New.
003890
003890
--- libstdc++-v3/include/bits/valarray_before.h	(revision 233264)
003890
+++ libstdc++-v3/include/bits/valarray_before.h	(revision 233265)
003890
@@ -331,14 +331,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
003890
       { return pow(__x, __y); }
003890
   };
003890
 
003890
+  template<typename _Tp, bool _IsValidValarrayValue = !__is_abstract(_Tp)>
003890
+    struct __fun_with_valarray
003890
+    {
003890
+      typedef _Tp result_type;
003890
+    };
003890
+
003890
+  template<typename _Tp>
003890
+    struct __fun_with_valarray<_Tp, false>
003890
+    {
003890
+      // No result type defined for invalid value types.
003890
+    };
003890
 
003890
   // We need these bits in order to recover the return type of
003890
   // some functions/operators now that we're no longer using
003890
   // function templates.
003890
   template<typename, typename _Tp>
003890
-    struct __fun
003890
+    struct __fun : __fun_with_valarray<_Tp>
003890
     {
003890
-      typedef _Tp result_type;
003890
     };
003890
 
003890
   // several specializations for relational operators.
003890
--- libstdc++-v3/testsuite/26_numerics/valarray/69116.cc	(nonexistent)
003890
+++ libstdc++-v3/testsuite/26_numerics/valarray/69116.cc	(revision 233265)
003890
@@ -0,0 +1,53 @@
003890
+// Copyright (C) 2016 Free Software Foundation, Inc.
003890
+//
003890
+// This file is part of the GNU ISO C++ Library.  This library is free
003890
+// software; you can redistribute it and/or modify it under the
003890
+// terms of the GNU General Public License as published by the
003890
+// Free Software Foundation; either version 3, or (at your option)
003890
+// any later version.
003890
+
003890
+// This library is distributed in the hope that it will be useful,
003890
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
003890
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
003890
+// GNU General Public License for more details.
003890
+
003890
+// You should have received a copy of the GNU General Public License along
003890
+// with this library; see the file COPYING3.  If not see
003890
+// <http://www.gnu.org/licenses/>.
003890
+
003890
+// { dg-do compile }
003890
+// { dg-options "-std=gnu++98" }
003890
+
003890
+// libstdc++/69116
003890
+
003890
+#include <exception>
003890
+#include <valarray>
003890
+
003890
+template<typename T>
003890
+  void foo(const T&) { }
003890
+
003890
+struct X : std::exception // makes namespace std an associated namespace
003890
+{
003890
+  virtual void pure() = 0;
003890
+
003890
+  typedef void(*func_type)(const X&);
003890
+
003890
+  void operator+(func_type) const;
003890
+  void operator-(func_type) const;
003890
+  void operator*(func_type) const;
003890
+  void operator/(func_type) const;
003890
+  void operator%(func_type) const;
003890
+  void operator<<(func_type) const;
003890
+  void operator>>(func_type) const;
003890
+};
003890
+
003890
+void foo(X& x)
003890
+{
003890
+  x + foo;
003890
+  x - foo;
003890
+  x * foo;
003890
+  x / foo;
003890
+  x % foo;
003890
+  x << foo;
003890
+  x >> foo;
003890
+}