Commit 3bed46f6 by Jason Merrill Committed by Jason Merrill

* pt.c (unify) [TEMPLATE_TYPE_PARM]: Allow VLA for C++0x 'auto'.

From-SVN: r177476
parent 2c331232
2011-08-05 Jason Merrill <jason@redhat.com>
* pt.c (unify) [TEMPLATE_TYPE_PARM]: Allow VLA for C++0x 'auto'.
2011-08-04 Jakub Jelinek <jakub@redhat.com> 2011-08-04 Jakub Jelinek <jakub@redhat.com>
PR middle-end/49905 PR middle-end/49905
......
...@@ -15932,10 +15932,11 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict, ...@@ -15932,10 +15932,11 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
that were talking about variable-sized arrays (like that were talking about variable-sized arrays (like
`int[n]'), rather than arrays of unknown size (like `int[n]'), rather than arrays of unknown size (like
`int[]').) We'll get very confused by such a type since `int[]').) We'll get very confused by such a type since
the bound of the array will not be computable in an the bound of the array is not constant, and therefore
instantiation. Besides, such types are not allowed in not mangleable. Besides, such types are not allowed in
ISO C++, so we can do as we please here. */ ISO C++, so we can do as we please here. We do allow
if (variably_modified_type_p (arg, NULL_TREE)) them for 'auto' deduction, since that isn't ABI-exposed. */
if (!is_auto (parm) && variably_modified_type_p (arg, NULL_TREE))
return unify_vla_arg (explain_p, arg); return unify_vla_arg (explain_p, arg);
/* Strip typedefs as in convert_template_argument. */ /* Strip typedefs as in convert_template_argument. */
......
2011-08-05 Jason Merrill <jason@redhat.com>
* g++.dg/ext/vla11.C: New.
2011-08-05 Richard Guenther <rguenther@suse.de> 2011-08-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/49984 PR tree-optimization/49984
......
// Test that auto works with VLAs.
// { dg-options -std=c++0x }
void bar(int n)
{
float loc2[n];
auto&& range = loc2;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment