PR c++/85864 - literal template and default template arg.
authorJason Merrill <jason@redhat.com>
Thu, 24 May 2018 14:27:10 +0000 (10:27 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 24 May 2018 14:27:10 +0000 (10:27 -0400)
* pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.

From-SVN: r260672

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp1y/udlit-char-template2.C [new file with mode: 0644]

index 4f4c9e7..c8832a1 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-24  Jason Merrill  <jason@redhat.com>
+
+       PR c++/85864 - literal template and default template arg.
+       * pt.c (instantiation_dependent_r): Handle NONTYPE_ARGUMENT_PACK.
+
 2018-05-24  Marek Polacek  <polacek@redhat.com>
 
        PR c++/85847
index 0b04770..d118105 100644 (file)
@@ -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 (file)
index 0000000..06c1326
--- /dev/null
@@ -0,0 +1,23 @@
+// PR c++/85864
+// { dg-do compile { target c++14 } }
+
+template<class T, T... S> struct String_template {};
+
+template<class C, C... S>
+constexpr String_template<C, S...> operator""_template() {
+    return String_template<C, S...> {};
+}
+
+template<class prefix = decltype("0x"_template), class T>
+int hex(T v) { return 1; }
+
+template<int v> 
+void tt2() {
+  //    auto h2 = hex<decltype("0x"_template)>(1);
+    auto h = hex(2);
+}
+
+int main() {
+  //    auto h = hex(2);
+  //    return h;
+}