Implement P0127R2, Declaring non-type parameters with auto.
authorJason Merrill <jason@redhat.com>
Wed, 9 Nov 2016 20:02:50 +0000 (15:02 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 9 Nov 2016 20:02:50 +0000 (15:02 -0500)
commit4a826ca6feb3c7ec3ef6287214a3f2820222c97e
tree760d23d9253039365e07de038db17dfe9aada879
parentff1f317b3c1fdcfb061e20f3474f77c183189830
Implement P0127R2, Declaring non-type parameters with auto.

gcc/cp/
* cp-tree.h (enum auto_deduction_context): Add adc_unify.
* decl.c (grokdeclarator): Allow 'auto' in C++17 template non-type
parameter types.
* pt.c (do_auto_deduction): Add outer_targs parameter.
(convert_template_argument): Call do_auto_deduction.  If adc_unify,
don't give up on dependent init.
(unify): Likewise.  In C++17, walk into the type of a
TEMPLATE_PARM_INDEX.
(for_each_template_parm): Add any_fn parameter.
(struct pair_fn_data): Likewise.
(for_each_template_parm_r): Call it for any tree.  In C++17, walk
into the type of a TEMPLATE_PARM_INDEX.
(zero_r, array_deduction_r, try_array_deduction): New.
(type_unification_real): Call try_array_deduction.
(get_partial_spec_bindings): Likewise.
gcc/c-family/
* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_template_auto.

From-SVN: r242017
15 files changed:
gcc/c-family/ChangeLog
gcc/c-family/c-cppbuiltin.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/auto9.C
gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C
gcc/testsuite/g++.dg/cpp1z/nontype-auto1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/nontype-auto2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/nontype-auto3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/nontype-auto4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/nontype-auto5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp1z/nontype-auto6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/template/partial5.C