re PR c++/8160 (ICE in build_modify_expr, at cp/typeck.c:5494: Array initialization)

PR c++/8160
	* typeck2.c (process_init_constructor): Call complete_array_type.

	PR c++/8149
	* decl.c (make_typename_type): Issue errors about invalid results.

	PR c++/8160
	* g++.dg/template/complit1.C: New test.

	PR c++/8149
	* g++.dg/template/typename4.C: Likewise.

From-SVN: r58663
This commit is contained in:
Mark Mitchell 2002-10-31 00:04:12 +00:00 committed by Mark Mitchell
parent 9402f6fb74
commit 8c081e84f7
6 changed files with 39 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2002-10-30 Mark Mitchell <mark@codesourcery.com>
PR c++/8160
* typeck2.c (process_init_constructor): Call complete_array_type.
PR c++/8149
* decl.c (make_typename_type): Issue errors about invalid results.
2002-10-30 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Core issue 287, PR c++/7639

View File

@ -5702,6 +5702,13 @@ make_typename_type (context, name, complain)
t = lookup_field (context, name, 0, 1);
if (t)
{
if (TREE_CODE (t) != TYPE_DECL)
{
if (complain & tf_error)
error ("no type named `%#T' in `%#T'", name, context);
return error_mark_node;
}
if (complain & tf_parsing)
type_access_control (context, t);
else

View File

@ -942,6 +942,8 @@ process_init_constructor (type, init, elts)
return error_mark_node;
result = build (CONSTRUCTOR, type, NULL_TREE, nreverse (members));
if (TREE_CODE (type) == ARRAY_TYPE && TYPE_DOMAIN (type) == NULL_TREE)
complete_array_type (type, result, /*do_default=*/0);
if (init)
TREE_HAS_CONSTRUCTOR (result) = TREE_HAS_CONSTRUCTOR (init);
if (allconstant) TREE_CONSTANT (result) = 1;

View File

@ -1,3 +1,11 @@
2002-10-30 Mark Mitchell <mark@codesourcery.com>
PR c++/8160
* g++.dg/template/complit1.C: New test.
PR c++/8149
* g++.dg/template/typename4.C: Likewise.
2002-10-30 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
Core issue 287, PR c++/7639

View File

@ -0,0 +1,11 @@
// { dg-options "" }
template <int D> struct C {
int d[3];
C();
};
template<int D>
C<D>::C() : d((int[]){1,2,3}) {};
template class C<1>;

View File

@ -0,0 +1,3 @@
struct B { template <typename U> struct C; };
template <typename T> struct A { typedef typename T::C V; }; // { dg-error "" }
void f () { A<B>::V p; } // { dg-error "" }