re PR c++/60277 (Bogus "inline function virtual ..." used but never defined)
authorJason Merrill <jason@redhat.com>
Fri, 21 Feb 2014 14:56:46 +0000 (09:56 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 21 Feb 2014 14:56:46 +0000 (09:56 -0500)
PR c++/60277
* call.c (build_array_conv): Don't crash on VLA.

From-SVN: r208001

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

index 0dff516..61f5859 100644 (file)
@@ -1,5 +1,8 @@
 2014-02-21  Jason Merrill  <jason@redhat.com>
 
+       PR c++/60277
+       * call.c (build_array_conv): Don't crash on VLA.
+
        PR c++/60248
        * mangle.c (mangle_decl): Don't make an alias for a TYPE_DECL.
 
index d4e8a28..d3db585 100644 (file)
@@ -948,7 +948,8 @@ build_array_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
   bool user = false;
   enum conversion_rank rank = cr_exact;
 
-  if (TYPE_DOMAIN (type))
+  if (TYPE_DOMAIN (type)
+      && !variably_modified_type_p (TYPE_DOMAIN (type), NULL_TREE))
     {
       unsigned HOST_WIDE_INT alen = tree_to_uhwi (array_type_nelts_top (type));
       if (alen < len)
diff --git a/gcc/testsuite/g++.dg/cpp1y/vla13.C b/gcc/testsuite/g++.dg/cpp1y/vla13.C
new file mode 100644 (file)
index 0000000..71b5452
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/60277
+// { dg-options "-std=c++1y -pedantic-errors" }
+
+void foo(int n)
+{
+  int a[n];
+  int (&r)[n] = {};            // { dg-error "" }
+}