Blame SOURCES/gcc48-pr69116.patch

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