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

            Bug ID: 89876
           Summary: ICE in convert_like_real on decltype expression
                    involving string conversion to char*
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The following ill-formed test case triggers an ICE in GCC 8 and 9:

$ cat u.C && gcc -S -Wall -Wextra u.C
template <typename T>
T f (T, char*);

template <typename T>
decltype (f (T (), "")) g (T) { }

void h () { g (0); }

u.C: In substitution of ‘template<class T> decltype (f(T(), "")) g(T) [with T =
int]’:
u.C:7:17:   required from here
u.C:5:20: warning: ISO C++ forbids converting a string constant to ‘char*’
[-Wwrite-strings]
    5 | decltype (f (T (), "")) g (T) { }
      |                    ^~
‘
Internal compiler error: Error reporting routines re-entered.
0xb7e259 string_conv_p(tree_node const*, tree_node const*, int)
        /src/gcc/git-svn/gcc/cp/typeck.c:2243
0x8435b5 convert_like_real
        /src/gcc/git-svn/gcc/cp/call.c:7449
0x8470b6 build_over_call
        /src/gcc/git-svn/gcc/cp/call.c:8379
0x837221 build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        /src/gcc/git-svn/gcc/cp/call.c:4519
0xb20ec0 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        /src/gcc/git-svn/gcc/cp/semantics.c:2585
0xaca585 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /src/gcc/git-svn/gcc/cp/pt.c:19022
0xab38ae tsubst(tree_node*, tree_node*, int, tree_node*)
        /src/gcc/git-svn/gcc/cp/pt.c:15068
0x960b6c dump_template_bindings
        /src/gcc/git-svn/gcc/cp/error.c:407
0x96747e dump_substitution
        /src/gcc/git-svn/gcc/cp/error.c:1544
0x968a99 dump_function_decl
        /src/gcc/git-svn/gcc/cp/error.c:1700
0x96617a dump_decl
        /src/gcc/git-svn/gcc/cp/error.c:1278
0x96f216 decl_to_string
        /src/gcc/git-svn/gcc/cp/error.c:3076
0x97239b cp_printer
        /src/gcc/git-svn/gcc/cp/error.c:4090
0x23f7fef pp_format(pretty_printer*, text_info*)
        /src/gcc/git-svn/gcc/pretty-print.c:1390
0x23f83f9 pp_format_verbatim(pretty_printer*, text_info*)
        /src/gcc/git-svn/gcc/pretty-print.c:1452
0x23f8ac7 pp_verbatim(pretty_printer*, char const*, ...)
        /src/gcc/git-svn/gcc/pretty-print.c:1671
0x970c67 print_instantiation_full_context
        /src/gcc/git-svn/gcc/cp/error.c:3474
0x9711c0 maybe_print_instantiation_context
        /src/gcc/git-svn/gcc/cp/error.c:3622
0x96fbda cp_diagnostic_starter
        /src/gcc/git-svn/gcc/cp/error.c:3325
0x23d6c5b diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*)
        /src/gcc/git-svn/gcc/diagnostic.c:1016
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to