diff options
author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-04-09 05:38:40 +0000 |
---|---|---|
committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2017-04-09 05:38:40 +0000 |
commit | 8e6dfb5bf8684e82968ba3b3a1a520be24f0d71a (patch) | |
tree | 813b13549d2353376fed45ec52e100c249068ba8 | |
parent | 4841d4ef4b0019599b8f3c48cb259fa40923b6b8 (diff) | |
download | gcc-8e6dfb5bf8684e82968ba3b3a1a520be24f0d71a.tar.gz |
PR c++/80356 - ICE with reference to function template argument.
PR c++/79294
* pt.c (convert_nontype_argument_function): Adjust type even with a
value-dependent argument.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246794 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/pt.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/fn-ref1.C | 4 |
3 files changed, 11 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e980456918e..ee8de4c3f8a 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2017-04-07 Jason Merrill <jason@redhat.com> + PR c++/80356 - ICE with reference to function template argument. + PR c++/79294 + * pt.c (convert_nontype_argument_function): Adjust type even with a + value-dependent argument. + PR c++/80267 - ICE with nested capture of reference PR c++/60992 * pt.c (tsubst_copy): Handle lookup finding a capture proxy. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2d1e81fffd1..5a55f179096 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -5981,7 +5981,7 @@ convert_nontype_argument_function (tree type, tree expr, return error_mark_node; if (value_dependent_expression_p (fn)) - return fn; + goto accept; fn_no_ptr = strip_fnptr_conv (fn); if (TREE_CODE (fn_no_ptr) == ADDR_EXPR) @@ -6030,6 +6030,7 @@ convert_nontype_argument_function (tree type, tree expr, return NULL_TREE; } + accept: if (TREE_CODE (type) == REFERENCE_TYPE) fn = build_address (fn); if (!same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (fn))) diff --git a/gcc/testsuite/g++.dg/template/fn-ref1.C b/gcc/testsuite/g++.dg/template/fn-ref1.C new file mode 100644 index 00000000000..b2c442913a3 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/fn-ref1.C @@ -0,0 +1,4 @@ +// PR c++/80356 + +template <int (&)(int, int)> struct a; +template <int (&b)(int, int)> a<b> f(); |