diff options
author | Jason Merrill <jason@redhat.com> | 2016-12-21 14:38:35 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2016-12-21 14:38:35 -0500 |
commit | a9410b4fe946b3f82ff2254b46ef53573897d68e (patch) | |
tree | fcffa3b5c7642405863b779e6991c5dfc2a1ff09 /gcc/cp | |
parent | a93634ba09c4b33d95233e48d9c452a529555d05 (diff) | |
download | gcc-a9410b4fe946b3f82ff2254b46ef53573897d68e.zip gcc-a9410b4fe946b3f82ff2254b46ef53573897d68e.tar.gz gcc-a9410b4fe946b3f82ff2254b46ef53573897d68e.tar.bz2 |
Check that a partial specialization is more specialized.
* pt.c (process_partial_specialization): Use
get_partial_spec_bindings to check that the partial specialization
is more specialized than the primary template.
From-SVN: r243868
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/pt.c | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4c68b1e..7faac15 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2016-12-21 Jason Merrill <jason@redhat.com> + * pt.c (process_partial_specialization): Use + get_partial_spec_bindings to check that the partial specialization + is more specialized than the primary template. + * pt.c (convert_template_argument): Pass args to do_auto_deduction. (mark_template_parm): Handle deducibility from type of non-type argument here. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 9d9c35e..8abbcfb 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -4606,9 +4606,20 @@ process_partial_specialization (tree decl) "primary template because it replaces multiple parameters " "with a pack expansion"); inform (DECL_SOURCE_LOCATION (maintmpl), "primary template here"); + /* Avoid crash in process_partial_specialization. */ return decl; } + /* If we aren't in a dependent class, we can actually try deduction. */ + else if (tpd.level == 1 + && !get_partial_spec_bindings (maintmpl, maintmpl, specargs)) + { + if (permerror (input_location, "partial specialization %qD is not " + "more specialized than", decl)) + inform (DECL_SOURCE_LOCATION (maintmpl), "primary template %qD", + maintmpl); + } + /* [temp.class.spec] A partially specialized non-type argument expression shall not |