aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2019-04-17 23:32:24 -0400
committerJason Merrill <jason@gcc.gnu.org>2019-04-17 23:32:24 -0400
commit5a58e967b526eba3d9b850cd7bc76dcc580bf708 (patch)
tree844ecad256d70dffae00df101a967a92775604d0 /gcc/cp
parent19caab83ca8b30a1a37ec968aaea8086b096d113 (diff)
downloadgcc-5a58e967b526eba3d9b850cd7bc76dcc580bf708.zip
gcc-5a58e967b526eba3d9b850cd7bc76dcc580bf708.tar.gz
gcc-5a58e967b526eba3d9b850cd7bc76dcc580bf708.tar.bz2
PR c++/90047 - ICE with enable_if alias template.
In order to make alias templates useful for SFINAE we instantiate them under the prevailing 'complain' argument, so an error encountered while instantiating during SFINAE context is silent. The problem in this PR comes when we later look up the erroneous instantiation and don't give an error at that point. Fixed by not adding an erroneous instantiation to the hash table, so we instantiate it again when needed and get the error. This required changes to a number of tests, which previously said "substitution failed:" with no explanation of what the failure was; now we properly explain. * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the hash table when we're in SFINAE context. From-SVN: r270433
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c3
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a37a6c2..bfaf355 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2019-04-17 Jason Merrill <jason@redhat.com>
+
+ PR c++/90047 - ICE with enable_if alias template.
+ * pt.c (tsubst_decl) [TYPE_DECL]: Don't put an erroneous decl in the
+ hash table when we're in SFINAE context.
+
2019-04-17 Marek Polacek <polacek@redhat.com>
PR c++/90124 - bogus error with incomplete type in decltype.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f800131..3a11eaa 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -13948,7 +13948,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain)
DECL_TEMPLATE_INFO (r) = build_template_info (tmpl, argvec);
SET_DECL_IMPLICIT_INSTANTIATION (r);
- register_specialization (r, gen_tmpl, argvec, false, hash);
+ if (!error_operand_p (r) || (complain & tf_error))
+ register_specialization (r, gen_tmpl, argvec, false, hash);
}
else
{