]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/67369 (ICE (in tsubst_decl, at cp/pt.c:11302) with -std=c++14)
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 8 Sep 2015 15:02:01 +0000 (15:02 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 8 Sep 2015 15:02:01 +0000 (15:02 +0000)
/cp
2015-09-08  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/67369
* pt.c (tsubst_copy, [case FUNCTION_DECL]): Do not call tsubst
if the first argument isn't a template.

/testsuite
2015-09-08  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/67369
* g++.dg/cpp1y/lambda-generic-ice4.C: New.

From-SVN: r227530

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

index f8185070ebbbd3abc43ae900fd0ff815b62a2f68..6115fd19f0399603c67c9ff0112cb861d3f7d7d1 100644 (file)
@@ -1,3 +1,9 @@
+2015-09-08  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/67369
+       * pt.c (tsubst_copy, [case FUNCTION_DECL]): Do not call tsubst
+       if the first argument isn't a template.
+
 2015-09-03  Martin Sebor  <msebor@redhat.com>
 
        PR c/66516
index ec32c5a05426d0a6f7f5c3d15566990883268b31..2544751cb42c0f757b2d3af1c7454f78de5859c6 100644 (file)
@@ -13599,8 +13599,9 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
              if (r)
                {
                  /* Make sure that the one we found is the one we want.  */
-                 tree ctx = tsubst (DECL_CONTEXT (t), args,
-                                    complain, in_decl);
+                 tree ctx = DECL_CONTEXT (t);
+                 if (DECL_LANG_SPECIFIC (ctx) && DECL_TEMPLATE_INFO (ctx))
+                   ctx = tsubst (ctx, args, complain, in_decl);
                  if (ctx != DECL_CONTEXT (r))
                    r = NULL_TREE;
                }
index 5fece2fc090c43a1de55c030352189e5a5960949..e75dec7813ffa9a8c5a7dda5b8846b21440c650f 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-08  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/67369
+       * g++.dg/cpp1y/lambda-generic-ice4.C: New.
+
 2015-09-07  Marek Polacek  <polacek@redhat.com>
 
        PR inline-asm/67448
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice4.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice4.C
new file mode 100644 (file)
index 0000000..ec4db83
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/67369
+// { dg-do compile { target c++14 } }
+
+int main() {
+  unsigned const nsz = 0;
+  auto repeat_conditional = [&](auto) {
+    auto new_sz = nsz;
+  };
+  repeat_conditional(1);
+}