This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.
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] {} ();
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]