[PR c++/84979] reject auto in explicit tmpl args for tmpl-fn
commitcb7f839bae6ce35d616a3f1eb66e33df8af3b3de
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 5 Apr 2018 04:26:36 +0000 (5 04:26 +0000)
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 5 Apr 2018 04:26:36 +0000 (5 04:26 +0000)
tree06ddb1def51912f29c6d94f008bbdf5cc0ed872b
parent40c5a92ba3528e96a7191e70d502c6cfc2cbc0f3
[PR c++/84979] reject auto in explicit tmpl args for tmpl-fn

With concepts, we accept auto in explicit template arguments, but we
should only accept them for template classes.  Passing them to
template functions or variables is not allowed.  So, reject it, at
parse time if possible, at specialization time otherwise.

for  gcc/cp/ChangeLog

PR c++/84979
* pt.c (check_auto_in_tmpl_args): New.
(tsubst_qualified_id): Use it to reject template args
referencing auto for non-type templates.
* parser.c (cp_parser_template_id): Likewise.
* cp-tree.h (check_auto_in_tmpl_args): Declare.
* typeck2.c (build_functional_cast): Report correct location
for invalid use of auto.

for  gcc/testsuite/ChangeLog

PR c++/84979
* g++.dg/concepts/pr84979.C: New.
* g++.dg/concepts/pr84979-2.C: New.
* g++.dg/concepts/pr84979-3.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259124 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/parser.c
gcc/cp/pt.c
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/concepts/pr84979-2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/concepts/pr84979-3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/concepts/pr84979.C [new file with mode: 0644]