Don't defer noexcept_deferred_spec.
authorNathan Sidwell <nathan@acm.org>
Fri, 16 Jun 2017 14:43:20 +0000 (14:43 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Fri, 16 Jun 2017 14:43:20 +0000 (14:43 +0000)
* cp-tree.h (unevaluated_noexcept_spec): Don't declare.
* decl.c (cxx_init_decl_processing): Initialize
noexcept_deferred_spec.
* except.c (unevaluated_noexcept_spec): Delete.
* class.c (deduce_noexcept_on_destructor): Use
noexcept_deferred_spec directly.
* method.c (implicitly_declare_fn): Likewise.

From-SVN: r249264

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/except.c
gcc/cp/method.c

index 7bf7ed1865e333d25db5c92037a56d75b5ea3802..ff832f8f44d579316ecc5f44086e14c86a2bf1a8 100644 (file)
@@ -1,5 +1,24 @@
 2017-06-16  Nathan Sidwell  <nathan@acm.org>
 
+       Don't defer noexcept_deferred_spec.
+       * cp-tree.h (unevaluated_noexcept_spec): Don't declare.
+       * decl.c (cxx_init_decl_processing): Initialize
+       noexcept_deferred_spec.
+       * except.c (unevaluated_noexcept_spec): Delete.
+       * class.c (deduce_noexcept_on_destructor): Use
+       noexcept_deferred_spec directly.
+       * method.c (implicitly_declare_fn): Likewise.
+
+       Make keyed_classes a vector.
+       * cp-tree.h (CPTI_KEYED_CLASSES, keyed_classes): Delete.
+       (keyed_classes): Declare as vector.
+       * decl.c (keyed_classes): Define.
+       (cxx_init_decl_processing): Allocate it.
+       (record_key_method_defined): Use vec_safe_push.
+       * class.c (finish_struct_1): Likewise.
+       * pt.c (instantiate_class_template_1): Likewise.
+       * decl2.c (c_parse_final_cleanups): Reverse iterate keyed_classes.
+
        Make rtti lazier
        * rtti.c (enum tinfo_kind): Add TK_DERIVED_TYPES,
        TK_VMI_CLASS_TYPES, TK_MAX.  Delete TK_FIXED.
index ebb46fbf38c20be66904ca1833c3b82dde3976c3..054dd3e26e762be79b882e1943b6a9c249831280 100644 (file)
@@ -5025,10 +5025,8 @@ void
 deduce_noexcept_on_destructor (tree dtor)
 {
   if (!TYPE_RAISES_EXCEPTIONS (TREE_TYPE (dtor)))
-    {
-      tree eh_spec = unevaluated_noexcept_spec ();
-      TREE_TYPE (dtor) = build_exception_variant (TREE_TYPE (dtor), eh_spec);
-    }
+    TREE_TYPE (dtor) = build_exception_variant (TREE_TYPE (dtor),
+                                               noexcept_deferred_spec);
 }
 
 /* For each destructor in T, deduce noexcept:
index 11250737ccb1a275e9de46b777991b09e933ac64..c56e59cbd7e84b5999707e92ff3e3b7996f642c8 100644 (file)
@@ -6317,7 +6317,6 @@ extern tree forward_parm                  (tree);
 extern bool is_trivially_xible                 (enum tree_code, tree, tree);
 extern bool is_xible                           (enum tree_code, tree, tree);
 extern tree get_defaulted_eh_spec              (tree);
-extern tree unevaluated_noexcept_spec          (void);
 extern void after_nsdmi_defaulted_late_checks   (tree);
 extern bool maybe_explain_implicit_delete      (tree);
 extern void explain_implicit_non_constexpr     (tree);
index 04418a19ddfcbd0f28129932353c0003cf8a0407..b6e854741825b671c6af79bb1f41e62c7d718f3a 100644 (file)
@@ -4078,6 +4078,8 @@ cxx_init_decl_processing (void)
   empty_except_spec = build_tree_list (NULL_TREE, NULL_TREE);
   noexcept_true_spec = build_tree_list (boolean_true_node, NULL_TREE);
   noexcept_false_spec = build_tree_list (boolean_false_node, NULL_TREE);
+  noexcept_deferred_spec = build_tree_list (make_node (DEFERRED_NOEXCEPT),
+                                           NULL_TREE);
 
 #if 0
   record_builtin_type (RID_MAX, NULL, string_type_node);
index ab7ab5db1586d6b9303c096c61d84cb593440759..9e41ec451af636e24a173872fc43477519286ea2 100644 (file)
@@ -1197,18 +1197,6 @@ build_noexcept_spec (tree expr, int complain)
     }
 }
 
-/* Returns a noexcept-specifier to be evaluated later, for an
-   implicitly-declared or explicitly defaulted special member function.  */
-
-tree
-unevaluated_noexcept_spec (void)
-{
-  if (!noexcept_deferred_spec)
-    noexcept_deferred_spec
-      = build_noexcept_spec (make_node (DEFERRED_NOEXCEPT), tf_none);
-  return noexcept_deferred_spec;
-}
-
 /* Returns a TRY_CATCH_EXPR that will put TRY_LIST and CATCH_LIST in the
    TRY and CATCH locations.  CATCH_LIST must be a STATEMENT_LIST */
 
index aa607d533466fd5ac6359521f0d989ba604ee0ea..98d36daa02cdf0b01ecc0e56064072fea6284bc7 100644 (file)
@@ -2023,7 +2023,7 @@ implicitly_declare_fn (special_function_kind kind, tree type,
     }
   else if (cxx_dialect >= cxx11)
     {
-      raises = unevaluated_noexcept_spec ();
+      raises = noexcept_deferred_spec;
       synthesized_method_walk (type, kind, const_p, NULL, &trivial_p,
                               &deleted_p, &constexpr_p, false,
                               inherited_ctor, inherited_parms);