diff options
author | Jason Merrill <jason@redhat.com> | 2020-03-11 00:53:01 -0400 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2020-03-11 16:45:39 -0400 |
commit | bde31a76ba48be49dbe26317ce5e19d10ae9f310 (patch) | |
tree | ef6e881a0d62e8369c1a1f8d78e1ee5e36b7d182 /gcc/cp | |
parent | 7eb5be6ab91ec03f93038ac2bcf3028cf2e7c82b (diff) | |
download | gcc-bde31a76ba48be49dbe26317ce5e19d10ae9f310.zip gcc-bde31a76ba48be49dbe26317ce5e19d10ae9f310.tar.gz gcc-bde31a76ba48be49dbe26317ce5e19d10ae9f310.tar.bz2 |
c++: Fix ICE with concepts and aliases [PR93907].
The problem here was that we were checking satisfaction once with 'e', a
typedef of 'void', and another time with 'void' directly, and treated them
as different for hashing based on the assumption that
canonicalize_type_argument would have already removed a typedef that wasn't
a complex dependent alias. But that wasn't happening here, so let's add a
call.
gcc/cp/ChangeLog
2020-03-11 Jason Merrill <jason@redhat.com>
PR c++/93907
* constraint.cc (tsubst_parameter_mapping): Canonicalize type
argument.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/constraint.cc | 6 | ||||
-rw-r--r-- | gcc/cp/cp-tree.h | 1 | ||||
-rw-r--r-- | gcc/cp/pt.c | 2 |
4 files changed, 13 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index da768cd..8cde300 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2020-03-11 Jason Merrill <jason@redhat.com> + + PR c++/93907 + * constraint.cc (tsubst_parameter_mapping): Canonicalize type + argument. + 2020-03-11 Marek Polacek <polacek@redhat.com> Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 4bb4a3f..697ed67 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -2232,7 +2232,11 @@ tsubst_parameter_mapping (tree map, tree args, subst_info info) else if (ARGUMENT_PACK_P (arg)) new_arg = tsubst_argument_pack (arg, args, complain, in_decl); if (!new_arg) - new_arg = tsubst_template_arg (arg, args, complain, in_decl); + { + new_arg = tsubst_template_arg (arg, args, complain, in_decl); + if (TYPE_P (new_arg)) + new_arg = canonicalize_type_argument (new_arg, complain); + } if (new_arg == error_mark_node) return error_mark_node; diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 0a7381c..757cdd8 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -7016,6 +7016,7 @@ extern tree resolve_nondeduced_context_or_error (tree, tsubst_flags_t); extern hashval_t iterative_hash_template_arg (tree arg, hashval_t val); extern tree coerce_template_parms (tree, tree, tree); extern tree coerce_template_parms (tree, tree, tree, tsubst_flags_t); +extern tree canonicalize_type_argument (tree, tsubst_flags_t); extern void register_local_specialization (tree, tree); extern tree retrieve_local_specialization (tree); extern tree extract_fnparm_pack (tree, tree *); diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cb237ba..789ccdb 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7943,7 +7943,7 @@ template_template_parm_bindings_ok_p (tree tparms, tree targs) /* Since type attributes aren't mangled, we need to strip them from template type arguments. */ -static tree +tree canonicalize_type_argument (tree arg, tsubst_flags_t complain) { if (!arg || arg == error_mark_node || arg == TYPE_CANONICAL (arg)) |