Patchwork C++ PATCH for c++/57404 (ICE with -g and VLA capture)

login
register
mail settings
Submitter Jason Merrill
Date May 30, 2013, 7:17 p.m.
Message ID <51A7A5D8.9080000@redhat.com>
Download mbox | patch
Permalink /patch/247676/
State New
Headers show

Comments

Jason Merrill - May 30, 2013, 7:17 p.m.
The anonymous struct type that I'm using for VLA capture doesn't have 
TYPE_LANG_SPECIFIC.

Tested x86_64-pc-linux-gnu, applying to trunk.

Patch

commit 8cc312abec2ea0f134d6991c0c8e7a070ce611db
Author: Jason Merrill <jason@redhat.com>
Date:   Thu May 30 09:59:25 2013 -0400

    	PR c++/57404
    	* cp-lang.c (cp_classify_record): Handle structs without
    	TYPE_LANG_SPECIFIC.

diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index 47a6004..a7fa8e4 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -127,7 +127,8 @@  cxx_dwarf_name (tree t, int verbosity)
 static enum classify_record
 cp_classify_record (tree type)
 {
-  if (CLASSTYPE_DECLARED_CLASS (type))
+  if (TYPE_LANG_SPECIFIC (type)
+      && CLASSTYPE_DECLARED_CLASS (type))
     return RECORD_IS_CLASS;
 
   return RECORD_IS_STRUCT;
diff --git a/gcc/testsuite/g++.dg/cpp1y/vla6.C b/gcc/testsuite/g++.dg/cpp1y/vla6.C
new file mode 100644
index 0000000..b725e7b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/vla6.C
@@ -0,0 +1,14 @@ 
+// PR c++/57404
+// { dg-options "-std=c++11 -g" }
+
+void f (int i)
+{
+  int a[i];
+  [&a] {};
+}
+
+void g (int i)
+{
+  int a[i];
+  [&a] {} ();
+}