Implement P0846R0, ADL and function templates.
authorMarek Polacek <polacek@redhat.com>
Thu, 1 Nov 2018 22:10:31 +0000 (22:10 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 1 Nov 2018 22:10:31 +0000 (22:10 +0000)
commit5d9a0e3b99e31a2167f6b6ab2473feb58f7c77e8
tree37c5dd82ef0aa75d2a14f04e83a976603e23d193
parent3af0c6bce5e4343a6099ba07e9dbfc3288de40a6
Implement P0846R0, ADL and function templates.

* decl.c (grokfndecl): Allow FUNCTION_DECL in assert.
* lex.c (unqualified_fn_lookup_error): Handle TEMPLATE_ID_EXPR.
* parser.c (cp_parser_postfix_expression): Do ADL for a template-name.
(cp_parser_template_id): Give errors if parsing the template argument
list didn't go well.  Allow FUNCTION_DECL in assert.
(cp_parser_template_name): Consider a name to refer to a template if
it is an unqualified-id followed by a <.  Don't return the identifier
if the decl is a function and dependent.
* pt.c (tsubst_copy) <case OVERLOAD>: Remove assert.

* g++.dg/addr_builtin-1.C: Adjust dg-error.
* g++.dg/cpp2a/fn-template1.C: New test.
* g++.dg/cpp2a/fn-template10.C: New test.
* g++.dg/cpp2a/fn-template11.C: New test.
* g++.dg/cpp2a/fn-template12.C: New test.
* g++.dg/cpp2a/fn-template13.C: New test.
* g++.dg/cpp2a/fn-template14.C: New test.
* g++.dg/cpp2a/fn-template15.C: New test.
* g++.dg/cpp2a/fn-template16.C: New test.
* g++.dg/cpp2a/fn-template2.C: New test.
* g++.dg/cpp2a/fn-template3.C: New test.
* g++.dg/cpp2a/fn-template4.C: New test.
* g++.dg/cpp2a/fn-template5.C: New test.
* g++.dg/cpp2a/fn-template6.C: New test.
* g++.dg/cpp2a/fn-template7.C: New test.
* g++.dg/cpp2a/fn-template8.C: New test.
* g++.dg/cpp2a/fn-template9.C: New test.
* g++.dg/parse/fn-template1.C: New test.
* g++.dg/parse/fn-template2.C: New test.
* g++.dg/parse/template19.C: Adjust dg-error.
* g++.dg/template/pr61745.C: Add target to dg-error.

From-SVN: r265734
27 files changed:
gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/lex.c
gcc/cp/parser.c
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/addr_builtin-1.C
gcc/testsuite/g++.dg/cpp2a/fn-template1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template10.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template11.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template12.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template13.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template14.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template15.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template16.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template4.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template5.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template6.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template7.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template8.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp2a/fn-template9.C [new file with mode: 0644]
gcc/testsuite/g++.dg/parse/fn-template1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/parse/fn-template2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/parse/template19.C
gcc/testsuite/g++.dg/template/pr61745.C