Blame SOURCES/gcc48-pr69116.patch

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