Bug 63485 - [5 Regression] ICE: canonical types differ for identical types A<const wchar_t [3]>::type and const char_type [3]
Summary: [5 Regression] ICE: canonical types differ for identical types A<const wchar_...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.0
: P3 normal
Target Milestone: 5.0
Assignee: Jason Merrill
URL:
Keywords:
: 63275 63454 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-08 13:50 UTC by Markus Trippelsdorf
Modified: 2014-10-10 21:22 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.8.3, 4.9.1
Known to fail: 5.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Trippelsdorf 2014-10-08 13:50:59 UTC
Running the Boost testsuite shows:

markus@x4 /tmp % cat date_time_format_parser.ii
template <typename C> struct A
{
  typedef C type;
};
template <class> class B
{
};
template <class Range> void as_literal (Range &);
template <typename> struct C
{
  typedef wchar_t char_type;
  const char_type on_full_year_placeholder[3];
  void
  on_extended_iso_date ()
  {
    B<A<wchar_t const[3]>::type> a;
    as_literal (on_full_year_placeholder);
  }
};
template <typename> struct date_time_format_parser_callback : C<wchar_t>
{
};
template <typename BaseT> 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<wchar_t> callback_type;
  typedef wchar_t char_type;
};
template <typename CharT, typename ParserT, typename CallbackT>
void
parse_format (CharT *p1, ParserT p2, CallbackT p3)
{
  CharT p = p2.parse (&p, p1, p3);
}
template <typename CharT>
void
parse_date_time_format (const CharT *, const CharT *p2,
                        date_time_format_parser_callback<CharT> &p3)
{
  D<F> b;
  parse_format (p2, b, p3);
}
template void
parse_date_time_format (const wchar_t *, const wchar_t *,
                        date_time_format_parser_callback<wchar_t> &);



markus@x4 /tmp % g++ -c -w -O0 date_time_format_parser.ii
date_time_format_parser.ii: In instantiation of ‘void C< <template-parameter-1-1> >::on_extended_iso_date() [with <template-parameter-1-1> = wchar_t]’:
date_time_format_parser.ii:30:5:   required from ‘D<BaseT>::char_type D<BaseT>::parse(const char_type*, const char_type*, typename BaseT::callback_type) [with BaseT = F; D<BaseT>::char_type = wchar_t; typename BaseT::callback_type = date_time_format_parser_callback<wchar_t>]’
date_time_format_parser.ii:42:33:   required from ‘void parse_format(CharT*, ParserT, CallbackT) [with CharT = const wchar_t; ParserT = D<F>; CallbackT = date_time_format_parser_callback<wchar_t>]’
date_time_format_parser.ii:50:16:   required from ‘void parse_date_time_format(const CharT*, const CharT*, date_time_format_parser_callback<CharT>&) [with CharT = wchar_t]’
date_time_format_parser.ii:54:68:   required from here
date_time_format_parser.ii:17:16: internal compiler error: canonical types differ for identical types A<const wchar_t [3]>::type and const char_type [3] {aka A<const wchar_t [3]>::type}
     as_literal (on_full_year_placeholder);
                ^
0x6b6ebe comptypes(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/typeck.c:1407
0x6b4ffd structural_comptypes
        ../../gcc/gcc/cp/typeck.c:1341
0x6b6e77 comptypes(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/typeck.c:1399
0x6d1c51 ocp_convert(tree_node*, tree_node*, int, int, int)
        ../../gcc/gcc/cp/cvt.c:686
0x57baf8 convert_like_real
        ../../gcc/gcc/cp/call.c:6471
0x57832c build_over_call
        ../../gcc/gcc/cp/call.c:7209
0x587911 build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, int)
        ../../gcc/gcc/cp/call.c:4072
0x7060b4 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int)
        ../../gcc/gcc/cp/semantics.c:2366
0x5fb7c6 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool)
        ../../gcc/gcc/cp/pt.c:15095
0x5db9d6 tsubst_expr
        ../../gcc/gcc/cp/pt.c:14272
0x5dbb1f tsubst_expr
        ../../gcc/gcc/cp/pt.c:13683
0x5db34b tsubst_expr
        ../../gcc/gcc/cp/pt.c:13669
0x5dc7e0 tsubst_expr
        ../../gcc/gcc/cp/pt.c:13855
0x5d9a7d instantiate_decl(tree_node*, int, bool)
        ../../gcc/gcc/cp/pt.c:20231
0x620192 instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:20347
0x65d4d4 cp_write_global_declarations()
        ../../gcc/gcc/cp/decl2.c:4367
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Markus Trippelsdorf 2014-10-08 14:17:27 UTC
Started with r214030.
Comment 2 Jason Merrill 2014-10-08 20:27:42 UTC
Author: jason
Date: Wed Oct  8 20:27:11 2014
New Revision: 216012

URL: https://gcc.gnu.org/viewcvs?rev=216012&root=gcc&view=rev
Log:
	PR c++/63485
	* tree.c (build_cplus_array_type): Look for a type with no
	typedef-name or attributes.

Added:
    trunk/gcc/testsuite/g++.dg/template/array29.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/tree.c
Comment 3 Jason Merrill 2014-10-08 20:42:38 UTC
Fixed.
Comment 4 Jason Merrill 2014-10-10 20:40:30 UTC
*** Bug 63454 has been marked as a duplicate of this bug. ***
Comment 5 Jason Merrill 2014-10-10 21:22:22 UTC
*** Bug 63275 has been marked as a duplicate of this bug. ***