From: jason Date: Wed, 8 Oct 2014 20:27:11 +0000 (+0000) Subject: PR c++/63485 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0bc1f5729fc64f7539dd4478b5ad743de6aad490;p=thirdparty%2Fgcc.git PR c++/63485 * tree.c (build_cplus_array_type): Look for a type with no typedef-name or attributes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216012 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c70de7e22ed1..975193d6a127 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2014-10-08 Jason Merrill + PR c++/63485 + * tree.c (build_cplus_array_type): Look for a type with no + typedef-name or attributes. + * call.c (call_copy_ctor): New. (build_over_call): Use it to avoid infinite recursion on invalid code. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index cfb0ed8c2998..5b11d5cc8f00 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -853,7 +853,9 @@ build_cplus_array_type (tree elt_type, tree index_type) { tree m = t; for (t = m; t; t = TYPE_NEXT_VARIANT (t)) - if (TREE_TYPE (t) == elt_type) + if (TREE_TYPE (t) == elt_type + && TYPE_NAME (t) == NULL_TREE + && TYPE_ATTRIBUTES (t) == NULL_TREE) break; if (!t) { diff --git a/gcc/testsuite/g++.dg/template/array29.C b/gcc/testsuite/g++.dg/template/array29.C new file mode 100644 index 000000000000..e43cb9d965ac --- /dev/null +++ b/gcc/testsuite/g++.dg/template/array29.C @@ -0,0 +1,56 @@ +// PR c++/63485 + +template struct A +{ + typedef C type; +}; +template class B +{ +}; +template void as_literal (Range &); +template struct C +{ + typedef wchar_t char_type; + const char_type on_full_year_placeholder[3]; + void + on_extended_iso_date () + { + B::type> a; + as_literal (on_full_year_placeholder); + } +}; +template struct date_time_format_parser_callback : C +{ +}; +template struct D +{ + typedef typename BaseT::char_type char_type; + char_type + parse (const char_type *, const char_type *, + typename BaseT::callback_type p3) + { + p3.on_extended_iso_date (); + } +}; +struct F +{ + typedef date_time_format_parser_callback callback_type; + typedef wchar_t char_type; +}; +template +void +parse_format (CharT *p1, ParserT p2, CallbackT p3) +{ + CharT p = p2.parse (&p, p1, p3); +} +template +void +parse_date_time_format (const CharT *, const CharT *p2, + date_time_format_parser_callback &p3) +{ + D b; + parse_format (p2, b, p3); +} +template void +parse_date_time_format (const wchar_t *, const wchar_t *, + date_time_format_parser_callback &);