diff mbox series

PR other/90695 reduce testcase to remove library dependency

Message ID 20190606225239.GA20217@redhat.com
State New
Headers show
Series PR other/90695 reduce testcase to remove library dependency | expand

Commit Message

Jonathan Wakely June 6, 2019, 10:52 p.m. UTC
This reproduces the original ICE fixed by r178857 (tested at r178852 and
r178860), without depending on a libstdc++ header that keeps changing.

The number of errors differs between C++14 and C++17 modes, so the fixed
test uses dg-excess-errors to match any number of them. The precise
errors aren't what's being tested for here anyway, the point of the test
is to verify the ICE in PR 50391 is fixed.

	PR other/90695
	* g++.dg/cpp0x/noexcept15.C: Remove dependency on library header.

Tested x86_64-linux. OK for trunk?
commit 2a63cb3a3500eb4ea3eec8b8761a767ec4637aa1
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Jun 6 23:26:52 2019 +0100

    PR other/90695 reduce testcase to remove library dependency
    
    This reproduces the original ICE fixed by r178857 (tested at r178852 and
    r178860), without depending on a libstdc++ header that keeps changing.
    
    The number of errors differs between C++14 and C++17 modes, so the fixed
    test uses dg-excess-errors to match any number of them. The precise
    errors aren't what's being tested for here anyway, the point of the test
    is to verify the ICE in PR 50391 is fixed.
    
            PR other/90695
            * g++.dg/cpp0x/noexcept15.C: Remove dependency on library header.

Comments

Jason Merrill June 10, 2019, 3:11 p.m. UTC | #1
On 6/6/19 6:52 PM, Jonathan Wakely wrote:
> This reproduces the original ICE fixed by r178857 (tested at r178852 and
> r178860), without depending on a libstdc++ header that keeps changing.
> 
> The number of errors differs between C++14 and C++17 modes, so the fixed
> test uses dg-excess-errors to match any number of them. The precise
> errors aren't what's being tested for here anyway, the point of the test
> is to verify the ICE in PR 50391 is fixed.
> 
>      PR other/90695
>      * g++.dg/cpp0x/noexcept15.C: Remove dependency on library header.
> 
> Tested x86_64-linux. OK for trunk?

OK, thanks.

Jason
diff mbox series

Patch

diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept15.C b/gcc/testsuite/g++.dg/cpp0x/noexcept15.C
index 5cbbea8a91a..6c6eef68915 100644
--- a/gcc/testsuite/g++.dg/cpp0x/noexcept15.C
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept15.C
@@ -1,12 +1,46 @@ 
 // PR c++/50391
 // { dg-do compile { target c++11 } }
 
-#include <type_traits>
+namespace std
+{
+  template<typename T, T Val>
+    struct integral_constant
+    { static constexpr T value = Val; };
+
+  template<typename T>
+    struct is_abstract
+    : integral_constant<bool, __is_abstract(T)>
+    { };
+
+  template<typename T, bool = is_abstract<T>::value>
+    struct is_destructible
+    : integral_constant<bool, true>
+    { };
+
+  template<typename T>
+    struct is_destructible<T, true>
+    : integral_constant<bool, false>
+    { };
+
+  template<typename T>
+    struct is_nothrow_move_constructible
+    : is_destructible<T>
+    { };
+
+  template<typename T>
+    struct decay
+    { typedef T type; };
+
+  template<typename T>
+    struct decay<T&>
+    { typedef T type; };
+
+} // std
 
 template<class Tp>
   struct single
   {
-    Tp elem;  // { dg-error "incomplete type" }
+    Tp elem;
 
     constexpr single(const Tp& e)
     : elem(e) { }
@@ -30,3 +64,5 @@  foo(Blob *b)
 {
   make_single(*b);
 }
+
+// { dg-excess-errors "incomplete type|not a member" }