OSDN Git Service

/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Jul 2008 09:08:41 +0000 (09:08 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 21 Jul 2008 09:08:41 +0000 (09:08 +0000)
2008-07-21  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/36870
* semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
TYPE_NOTHROW_P, not TREE_NOTHROW.
(trait_expr_value): Likewise.

/testsuite
2008-07-21  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/36870
* g++.dg/ext/has_nothrow_assign_odr.C: New.
* g++.dg/ext/has_nothrow_copy_odr.C: Likewise.
* g++.dg/ext/has_nothrow_constructor_odr.C: Likewise.
* g++.dg/ext/has_nothrow_assign.C: Adjust.
* g++.dg/ext/has_nothrow_copy.C: Likewise.
* g++.dg/ext/has_nothrow_constructor.C: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138024 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/has_nothrow_assign.C
gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/has_nothrow_constructor.C
gcc/testsuite/g++.dg/ext/has_nothrow_constructor_odr.C [new file with mode: 0644]
gcc/testsuite/g++.dg/ext/has_nothrow_copy.C
gcc/testsuite/g++.dg/ext/has_nothrow_copy_odr.C [new file with mode: 0644]

index 2112b8f..913f328 100644 (file)
@@ -1,3 +1,10 @@
+2008-07-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/36870
+       * semantics.c (classtype_has_nothrow_assign_or_copy_p): Use
+       TYPE_NOTHROW_P, not TREE_NOTHROW.
+       (trait_expr_value): Likewise.
+
 2008-07-18  Dodji Seketeli  <dseketel@redhat.com>
 
        PR c++/36407
index d2f56ea..3b91ddb 100644 (file)
@@ -4677,7 +4677,7 @@ classtype_has_nothrow_assign_or_copy_p (tree type, bool assign_p)
     return false;
 
   for (; fns; fns = OVL_NEXT (fns))
-    if (!TREE_NOTHROW (OVL_CURRENT (fns)))
+    if (!TYPE_NOTHROW_P (TREE_TYPE (OVL_CURRENT (fns))))
       return false;
 
   return true;
@@ -4712,7 +4712,8 @@ trait_expr_value (cp_trait_kind kind, tree type1, tree type2)
       type1 = strip_array_types (type1);
       return (trait_expr_value (CPTK_HAS_TRIVIAL_CONSTRUCTOR, type1, type2) 
              || (CLASS_TYPE_P (type1)
-                 && (t = locate_ctor (type1, NULL)) && TREE_NOTHROW (t)));
+                 && (t = locate_ctor (type1, NULL))
+                 && TYPE_NOTHROW_P (TREE_TYPE (t))));
 
     case CPTK_HAS_TRIVIAL_CONSTRUCTOR:
       type1 = strip_array_types (type1);
index bd32d6c..13f1468 100644 (file)
@@ -1,3 +1,13 @@
+2008-07-21  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/36870
+       * g++.dg/ext/has_nothrow_assign_odr.C: New.
+       * g++.dg/ext/has_nothrow_copy_odr.C: Likewise.
+       * g++.dg/ext/has_nothrow_constructor_odr.C: Likewise.
+       * g++.dg/ext/has_nothrow_assign.C: Adjust.
+       * g++.dg/ext/has_nothrow_copy.C: Likewise.
+       * g++.dg/ext/has_nothrow_constructor.C: Likewise.
+
 2008-07-17  Andreas Krebbel  <krebbel1@de.ibm.com>
 
        PR target/36822
index 525cac7..73a904e 100644 (file)
@@ -136,19 +136,13 @@ int main()
   assert (PTEST (C));
   assert (NTEST (C[]));
   assert (PTEST (D));
-#ifndef __PIC__
-  assert (PTEST (E));
-#endif
+  assert (NTEST (E));
   assert (NTEST (E1));
   assert (PTEST (F));
   assert (PTEST (G));
-#ifndef __PIC__
-  assert (PTEST (H));
-#endif
+  assert (NTEST (H));
   assert (NTEST (H1));
-#ifndef __PIC__
-  assert (PTEST (I));
-#endif
+  assert (NTEST (I));
   assert (NTEST (I1));
   assert (PTEST (J));
   assert (NTEST (const K));
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C b/gcc/testsuite/g++.dg/ext/has_nothrow_assign_odr.C
new file mode 100644 (file)
index 0000000..c38d76d
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { const S& operator= (const S&); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_assign (S) == f ());
+}
+
+const S& S::operator= (const S&) { }
+
+bool f () { return __has_nothrow_assign (S); }
index 7e747bc..60e9be8 100644 (file)
@@ -97,9 +97,7 @@ int main()
   assert (PTEST (C));
   assert (PTEST (C[]));
   assert (PTEST (D));
-#ifndef __PIC__
-  assert (PTEST (E));
-#endif
+  assert (NTEST (E));
   assert (NTEST (E1));
   assert (NTEST (F));
   assert (NTEST (G));
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_constructor_odr.C b/gcc/testsuite/g++.dg/ext/has_nothrow_constructor_odr.C
new file mode 100644 (file)
index 0000000..775e74a
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { S (); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_constructor (S) == f ());
+}
+
+S::S () { }
+
+bool f () { return __has_nothrow_constructor (S); }
index 6843d51..e8507cf 100644 (file)
@@ -126,19 +126,13 @@ int main()
   assert (PTEST (C));
   assert (NTEST (C[]));
   assert (PTEST (D));
-#ifndef __PIC__
-  assert (PTEST (E));
-#endif
+  assert (NTEST (E));
   assert (NTEST (E1));
   assert (PTEST (F));
   assert (PTEST (G));
-#ifndef __PIC__
-  assert (PTEST (H));
-#endif
+  assert (NTEST (H));
   assert (NTEST (H1));
-#ifndef __PIC__
-  assert (PTEST (I));
-#endif
+  assert (NTEST (I));
   assert (NTEST (I1));  
   assert (PTEST (J));
 
diff --git a/gcc/testsuite/g++.dg/ext/has_nothrow_copy_odr.C b/gcc/testsuite/g++.dg/ext/has_nothrow_copy_odr.C
new file mode 100644 (file)
index 0000000..499a11e
--- /dev/null
@@ -0,0 +1,16 @@
+// PR c++/36870
+// { dg-do "run" }
+#include <cassert>
+
+struct S { S (const S&); };
+
+bool f ();
+
+int main ()
+{
+  assert (__has_nothrow_copy (S) == f ());
+}
+
+S::S (const S&) { }
+
+bool f () { return __has_nothrow_copy (S); }