diff options
author | Jason Merrill <jason@redhat.com> | 2018-02-09 16:01:49 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2018-02-09 16:01:49 -0500 |
commit | 83fe399c27e269e48c54bf5d505973b5c03da072 (patch) | |
tree | 735b075cf6fd462d211da21ec9ca17eabb295b92 /gcc/cp | |
parent | c028d589e94a67795a25763bc95b778e1480f106 (diff) | |
download | gcc-83fe399c27e269e48c54bf5d505973b5c03da072.zip gcc-83fe399c27e269e48c54bf5d505973b5c03da072.tar.gz gcc-83fe399c27e269e48c54bf5d505973b5c03da072.tar.bz2 |
PR c++/81917 - ICE with void_t and partial specialization.
* pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before
calling most_specialized_partial_spec.
From-SVN: r257542
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 18 |
2 files changed, 15 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index cea51ff..9df4c29 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-02-09 Jason Merrill <jason@redhat.com> + + PR c++/81917 - ICE with void_t and partial specialization. + * pt.c (instantiate_class_template_1): Set TYPE_BEING_DEFINED before + calling most_specialized_partial_spec. + 2018-02-09 Nathan Sidwell <nathan@acm.org> PR c/84293 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9c57709..2816045 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -10347,14 +10347,14 @@ instantiate_class_template_1 (tree type) templ = most_general_template (CLASSTYPE_TI_TEMPLATE (type)); gcc_assert (TREE_CODE (templ) == TEMPLATE_DECL); + /* Mark the type as in the process of being defined. */ + TYPE_BEING_DEFINED (type) = 1; + /* Determine what specialization of the original template to instantiate. */ t = most_specialized_partial_spec (type, tf_warning_or_error); if (t == error_mark_node) - { - TYPE_BEING_DEFINED (type) = 1; - return error_mark_node; - } + return error_mark_node; else if (t) { /* This TYPE is actually an instantiation of a partial @@ -10379,16 +10379,16 @@ instantiate_class_template_1 (tree type) /* If the template we're instantiating is incomplete, then clearly there's nothing we can do. */ if (!COMPLETE_TYPE_P (pattern)) - return type; + { + /* We can try again later. */ + TYPE_BEING_DEFINED (type) = 0; + return type; + } /* If we've recursively instantiated too many templates, stop. */ if (! push_tinst_level (type)) return type; - /* Now we're really doing the instantiation. Mark the type as in - the process of being defined. */ - TYPE_BEING_DEFINED (type) = 1; - /* We may be in the middle of deferred access check. Disable it now. */ push_deferring_access_checks (dk_no_deferred); |