From: Nathan Sidwell <nathan@acm.org>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: [C++ PATCH] deferred noexcept spec
Date: Fri, 16 Jun 2017 14:46:00 -0000 [thread overview]
Message-ID: <1f0e1764-9bb8-426f-d40e-848be772470b@acm.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 235 bytes --]
We defer creating the deferred noexept spec. That's somewhat more
deferred than necessary. This patch creates the defered spec at the
point we create the noexcept true and false specs.
Applied to trunk.
nathan
--
Nathan Sidwell
[-- Attachment #2: def.diff --]
[-- Type: text/x-patch, Size: 3302 bytes --]
2017-06-16 Nathan Sidwell <nathan@acm.org>
Don't defer noexcept_deferred_spec.
* cp-tree.h (unevaluated_noexcept_spec): Don't declare.
(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.
Index: class.c
===================================================================
--- class.c (revision 249263)
+++ class.c (working copy)
@@ -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: cp-tree.h
===================================================================
--- cp-tree.h (revision 249263)
+++ cp-tree.h (working copy)
@@ -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: decl.c
===================================================================
--- decl.c (revision 249263)
+++ decl.c (working copy)
@@ -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: except.c
===================================================================
--- except.c (revision 249255)
+++ except.c (working copy)
@@ -1197,18 +1197,6 @@ build_noexcept_spec (tree expr, int comp
}
}
-/* 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: method.c
===================================================================
--- method.c (revision 249255)
+++ method.c (working copy)
@@ -2023,7 +2023,7 @@ implicitly_declare_fn (special_function_
}
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);
reply other threads:[~2017-06-16 14:46 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1f0e1764-9bb8-426f-d40e-848be772470b@acm.org \
--to=nathan@acm.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).