re PR c++/43143 ([c++0x] array value-initialization and variadics)

PR c++/43143
	* typeck2.c (digest_init_r): Accept value init of array.

From-SVN: r157015
This commit is contained in:
Jason Merrill 2010-02-23 13:32:20 -05:00 committed by Jason Merrill
parent 3adcf52c82
commit c6569cd04e
4 changed files with 30 additions and 4 deletions

View File

@ -1,9 +1,13 @@
2010-02-23 Jason Merrill <jason@redhat.com>
PR c++/43143
* typeck2.c (digest_init_r): Accept value init of array.
2010-02-22 Manuel López-Ibáñez <manu@gcc.gnu.org>
PR c++/43126
* typeck.c (convert_arguments): Update error message.
2010-02-22 Mike Stump <mikestump@comcast.net>
PR c++/43125

View File

@ -929,10 +929,12 @@ digest_init_r (tree type, tree init, bool nested, int flags)
}
if (TREE_CODE (type) == ARRAY_TYPE
&& TREE_CODE (init) != CONSTRUCTOR)
&& !BRACE_ENCLOSED_INITIALIZER_P (init))
{
/* Allow the result of build_array_copy. */
if (TREE_CODE (init) == TARGET_EXPR
/* Allow the result of build_array_copy and of
build_value_init_noctor. */
if ((TREE_CODE (init) == TARGET_EXPR
|| TREE_CODE (init) == CONSTRUCTOR)
&& (same_type_ignoring_top_level_qualifiers_p
(type, TREE_TYPE (init))))
return init;

View File

@ -1,3 +1,8 @@
2010-02-23 Jason Merrill <jason@redhat.com>
PR c++/43143
* g++.dg/cpp0x/variadic100.C: New.
2010-02-23 Jason Merrill <jason@redhat.com>
PR debug/42800

View File

@ -0,0 +1,15 @@
// PR c++/43143
// { dg-options "-std=c++0x" }
template<typename T>
T&& declval();
template<class T, class... Args>
void test() {
T t(declval<Args>()...);
}
int main() {
test<const int>(); // OK
test<int[23]>(); // Error
}