Commit 462aa169 by Jason Merrill Committed by Jason Merrill

pt.c (tsubst_expr): Handle getting an AGGR_INIT_EXPR from build_value_init.

	* pt.c (tsubst_expr) [DECL_EXPR]: Handle getting an AGGR_INIT_EXPR
	from build_value_init.
	* init.c (build_value_init_noctor): Give error for unknown array
	bound.

From-SVN: r162603
parent 418e920f
2010-07-27 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_expr) [DECL_EXPR]: Handle getting an AGGR_INIT_EXPR
from build_value_init.
* init.c (build_value_init_noctor): Give error for unknown array
bound.
2010-07-27 Joseph Myers <joseph@codesourcery.com> 2010-07-27 Joseph Myers <joseph@codesourcery.com>
* cp-objcp-common.h (LANG_HOOKS_MISSING_ARGUMENT): Remove. * cp-objcp-common.h (LANG_HOOKS_MISSING_ARGUMENT): Remove.
......
...@@ -379,7 +379,10 @@ build_value_init_noctor (tree type) ...@@ -379,7 +379,10 @@ build_value_init_noctor (tree type)
/* If we have an error_mark here, we should just return error mark /* If we have an error_mark here, we should just return error mark
as we don't know the size of the array yet. */ as we don't know the size of the array yet. */
if (max_index == error_mark_node) if (max_index == error_mark_node)
return error_mark_node; {
error ("cannot value-initialize array of unknown bound %qT", type);
return error_mark_node;
}
gcc_assert (TREE_CODE (max_index) == INTEGER_CST); gcc_assert (TREE_CODE (max_index) == INTEGER_CST);
/* A zero-sized array, which is accepted as an extension, will /* A zero-sized array, which is accepted as an extension, will
......
...@@ -11697,14 +11697,18 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl, ...@@ -11697,14 +11697,18 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
tree t = RECUR (init); tree t = RECUR (init);
if (init && !t) if (init && !t)
/* If we had an initializer but it {
instantiated to nothing, /* If we had an initializer but it
value-initialize the object. This will instantiated to nothing,
only occur when the initializer was a value-initialize the object. This will
pack expansion where the parameter packs only occur when the initializer was a
used in that expansion were of length pack expansion where the parameter packs
zero. */ used in that expansion were of length
init = build_value_init (TREE_TYPE (decl)); zero. */
init = build_value_init (TREE_TYPE (decl));
if (TREE_CODE (init) == AGGR_INIT_EXPR)
init = get_target_expr (init);
}
else else
init = t; init = t;
} }
......
2010-07-27 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/variadic102.C: New.
* g++.dg/cpp0x/variadic103.C: New.
2010-07-27 Maxim Kuvyrkov <maxim@codesourcery.com> 2010-07-27 Maxim Kuvyrkov <maxim@codesourcery.com>
PR rtl-optimization/40956 PR rtl-optimization/40956
......
// { dg-options "-std=c++0x" }
struct nAny {
template<class... T>
nAny(T&&...);
};
template<class T>
T&& create();
template<class T, class... Args>
void test() {
T t(create<Args>()...);
(void) t;
}
int main() {
test<nAny>();
}
// { dg-options "-std=c++0x" }
template<class T>
T&& create();
template<class T, class... Args>
void test() {
T t(create<Args>()...); // { dg-error "unknown bound" }
(void) t;
}
int main() {
test<int[]>();
}
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