[Bug c++/63485] New: [5 Regression] ICE: canonical types differ for identical types A<const wchar_t [3]>::type and const char_type [3]

trippels at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Oct 8 13:51:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63485

            Bug ID: 63485
           Summary: [5 Regression] ICE: canonical types differ for
                    identical types A<const wchar_t [3]>::type and const
                    char_type [3]
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org

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.


More information about the Gcc-bugs mailing list