From 1268ecc26fc1289b6e9a10b38fa18b4354460ef1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 24 May 2018 10:27:10 -0400 Subject: [PATCH] PR c++/85864 - literal template and default template arg. * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK. From-SVN: r260672 --- gcc/cp/ChangeLog | 5 ++++ gcc/cp/pt.c | 1 + .../g++.dg/cpp1y/udlit-char-template2.C | 23 +++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp1y/udlit-char-template2.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4f4c9e78f1e..c8832a168f9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-05-24 Jason Merrill + + PR c++/85864 - literal template and default template arg. + * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK. + 2018-05-24 Marek Polacek PR c++/85847 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0b04770e123..d1181055af4 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -25212,6 +25212,7 @@ instantiation_dependent_r (tree *tp, int *walk_subtrees, TREE_TYPE. */ case TREE_LIST: case TREE_VEC: + case NONTYPE_ARGUMENT_PACK: return NULL_TREE; case TEMPLATE_PARM_INDEX: diff --git a/gcc/testsuite/g++.dg/cpp1y/udlit-char-template2.C b/gcc/testsuite/g++.dg/cpp1y/udlit-char-template2.C new file mode 100644 index 00000000000..06c13261156 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/udlit-char-template2.C @@ -0,0 +1,23 @@ +// PR c++/85864 +// { dg-do compile { target c++14 } } + +template struct String_template {}; + +template +constexpr String_template operator""_template() { + return String_template {}; +} + +template +int hex(T v) { return 1; } + +template +void tt2() { + // auto h2 = hex(1); + auto h = hex(2); +} + +int main() { + // auto h = hex(2); + // return h; +} -- 2.30.2