]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/61445 ([C++11] ice in instantiate_decl at cp/pt.c:19770)
authorJason Merrill <jason@redhat.com>
Mon, 14 Jul 2014 20:39:35 +0000 (16:39 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 14 Jul 2014 20:39:35 +0000 (16:39 -0400)
PR c++/61445
PR c++/56947
* pt.c (instantiate_decl): Don't check defer_ok for local class
members.

From-SVN: r212524

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

index 98af8db9c4b4803195c3a32234542816b41b51fb..0d66bb3820b93fa4147659352615086ff9af15a0 100644 (file)
@@ -1,3 +1,10 @@
+2014-07-14  Jason Merrill  <jason@redhat.com>
+
+       PR c++/61445
+       PR c++/56947
+       * pt.c (instantiate_decl): Don't check defer_ok for local class
+       members.
+
 2014-07-14  Jakub Jelinek  <jakub@redhat.com>
 
        PR middle-end/61294
index 7b79280da1ab8c1be516007a8f4213ee744fc885..b32cf6c387dac10cd653bd7ef5bf6d5fb00076b3 100644 (file)
@@ -19775,11 +19775,6 @@ instantiate_decl (tree d, int defer_ok,
   if (external_p && !always_instantiate_p (d))
     return d;
 
-  /* Any local class members should be instantiated from the TAG_DEFN
-     with defer_ok == 0.  */
-  gcc_checking_assert (!defer_ok || !decl_function_context (d)
-                      || LAMBDA_TYPE_P (DECL_CONTEXT (d)));
-
   gen_tmpl = most_general_template (tmpl);
   gen_args = DECL_TI_ARGS (d);
 
diff --git a/gcc/testsuite/g++.dg/template/local9.C b/gcc/testsuite/g++.dg/template/local9.C
new file mode 100644 (file)
index 0000000..90f14bb
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/61445
+
+template <typename T> void f (T)
+{
+  struct A
+  {
+    struct B { B(); };
+    void g () { B b; }
+  };
+}
+
+int main()
+{
+  f(0);
+}