]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/68396
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Nov 2015 18:25:38 +0000 (18:25 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 19 Nov 2015 18:25:38 +0000 (18:25 +0000)
2015-11-19  Ryan Burn  <contact@rnburn.com>

* pt.c (find_parameter_packs_r) [DECLTYPE_TYPE]: When traversing
the DECLTYPE_TYPE_EXPR, set type_pack_expansion_p to false.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230620 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 024290c16d04af7be5245abe02170cffe38746fd..d7804a0edae0e3e0bc888e6267d0a3ab2e524239 100644 (file)
@@ -1,3 +1,9 @@
+2015-11-19  Ryan Burn  <contact@rnburn.com>
+
+       PR c++/68396
+       * pt.c (find_parameter_packs_r) [DECLTYPE_TYPE]: When traversing
+       the DECLTYPE_TYPE_EXPR, set type_pack_expansion_p to false.
+
 2015-11-19  Cesar Philippidis  <cesar@codesourcery.com>
 
        * parser.h (struct cp_omp_declare_simd_data): Add clauses member.
index 29046572b2cf8ac4f4f6367c0c5237467bb8012c..b4a5e71b521b5f193afd5f2ee4fac2234959b57c 100644 (file)
@@ -3551,6 +3551,20 @@ find_parameter_packs_r (tree *tp, int *walk_subtrees, void* data)
       *walk_subtrees = 0;
       return NULL_TREE;
 
+    case DECLTYPE_TYPE:
+      {
+       /* When traversing a DECLTYPE_TYPE_EXPR, we need to set
+          type_pack_expansion_p to false so that any placeholders
+          within the expression don't get marked as parameter packs.  */
+       bool type_pack_expansion_p = ppd->type_pack_expansion_p;
+       ppd->type_pack_expansion_p = false;
+       cp_walk_tree (&DECLTYPE_TYPE_EXPR (t), &find_parameter_packs_r,
+                     ppd, ppd->visited);
+       ppd->type_pack_expansion_p = type_pack_expansion_p;
+       *walk_subtrees = 0;
+       return NULL_TREE;
+      }
+
     default:
       return NULL_TREE;
     }
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr68396.C b/gcc/testsuite/g++.dg/cpp1y/pr68396.C
new file mode 100644 (file)
index 0000000..2027d6e
--- /dev/null
@@ -0,0 +1,15 @@
+// { dg-do compile { target c++14 } }
+
+template <unsigned>
+auto f () {
+  return 2;
+}
+
+template <class>
+class A {};
+
+template <int... Ix>
+auto g () {
+  A<decltype(f<Ix> ())...>();
+  return f<2> ();
+}