+2013-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/53211
+ * pt.c (type_dependent_expression_p): Handle an array of unknown
+ bound depending on a variadic parameter.
+ * parser.c (cp_parser_range_for): Revert PR56794 changes.
+
2013-06-17 Richard Biener <rguenther@suse.de>
* cp-tree.h (ANON_AGGRNAME_FORMAT, ANON_AGGRNAME_P): Move to tree.h.
range_expr = error_mark_node;
stmt = begin_range_for_stmt (scope, init);
finish_range_for_decl (stmt, range_decl, range_expr);
- if (range_expr != error_mark_node
- && !type_dependent_expression_p (range_expr)
- /* The length of an array might be dependent. */
- && COMPLETE_TYPE_P (complete_type (TREE_TYPE (range_expr)))
+ if (!type_dependent_expression_p (range_expr)
/* do_auto_deduction doesn't mess with template init-lists. */
&& !BRACE_ENCLOSED_INITIALIZER_P (range_expr))
do_range_for_auto_deduction (range_decl, range_expr);
&& VAR_HAD_UNKNOWN_BOUND (expression))
return true;
+ /* An array of unknown bound depending on a variadic parameter, eg:
+
+ template<typename... Args>
+ void foo (Args... args)
+ {
+ int arr[] = { args... };
+ }
+
+ template<int... vals>
+ void bar ()
+ {
+ int arr[] = { vals... };
+ }
+
+ If the array has no length and has an initializer, it must be that
+ we couldn't determine its length in cp_complete_array_type because
+ it is dependent. */
+ if (VAR_P (expression)
+ && TREE_CODE (TREE_TYPE (expression)) == ARRAY_TYPE
+ && !TYPE_DOMAIN (TREE_TYPE (expression))
+ && DECL_INITIAL (expression))
+ return true;
+
if (TREE_TYPE (expression) == unknown_type_node)
{
if (TREE_CODE (expression) == ADDR_EXPR)
+2013-06-18 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/53211
+ * g++.dg/cpp0x/decltype55.C: New.
+
2013-06-18 Marek Polacek <polacek@redhat.com>
* gcc.dg/c90-fordecl-1.c: Adjust expected message.
* c-c++-common/cilk-plus/AN/sec_reduce_ind_same_value.c: New test.
2013-06-17 Balaji V. Iyer <balaji.v.iyer@intel.com>
-
+
* c-c++-common/cilk-plus/AN/array_test1.c: Make this an execution test.
Also changed the returns from error as distinct values so that it is
easier to debug.
-
+
2013-06-17 Sofiane Naci <sofiane.naci@arm.com>
* gcc.target/aarch64/scalar_intrinsics.c: Update.
--- /dev/null
+// PR c++/53211
+// { dg-do compile { target c++11 } }
+
+template<typename A, typename B>
+ struct is_same { static const bool value = false; };
+
+template<typename A>
+ struct is_same<A, A> { static const bool value = true; };
+
+template<typename... Args>
+void func(Args... args)
+{
+ int arr[] = { args... };
+ static_assert (is_same<decltype(arr), int[sizeof...(Args)]>::value, "");
+}
+
+int main()
+{
+ func(1, 2, 3, 4);
+}