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

            Bug ID: 120756
           Summary: internal compiler error: error reporting routines
                    re-entered with [[deprecated]]
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rush102333 at gmail dot com
  Target Milestone: ---

The following test triggers ICE since gcc-6: 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

struct A { 
    template <long> [[deprecated]] void foo (); 
};

template <long t> [[deprecated]] auto bar () -> decltype (&A::foo<t>);

void foo ()
{
  bar<0> ();
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Stack Dump:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

<source>: In substitution of 'template<long int t> decltype (& A::foo<t>) bar()
[with long int t = 0]':
<source>:5:10:   required from here
    5 |   bar<0> ();
      |   ~~~~~~~^~
<source>:2:39: warning: 'void A::foo() [with long int <anonymous> = 0]' is
deprecated [-Wdeprecated-declarations]
    2 | template <long t> [[deprecated]] auto bar () -> decltype (&A::foo<t>);
      |                                       ^~~
<source>:1:48: note: declared here
    1 | struct A { template <long> [[deprecated]] void foo (); };
      |                                                ^~~

internal compiler error: error reporting routines re-entered.
0x283a04e diagnostic_context::report_diagnostic(diagnostic_info*)
        ???:0
0x283a165 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x285a151 warning(diagnostic_option_id, char const*, ...)
        ???:0
0x182ec08 warn_deprecated_use(tree_node*, tree_node*)
        ???:0
0xbe9749 cp_handle_deprecated_or_unavailable(tree_node*, int)
        ???:0
0xbeaa72 mark_used(tree_node*, int)
        ???:0
0xd671ce resolve_nondeduced_context(tree_node*, int)
        ???:0
0xd92b40 finish_decltype_type(tree_node*, bool, int)
        ???:0
0xd3daaf tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x2886783 pretty_printer::format(text_info&)
        ???:0
0x2839ca6 diagnostic_context::report_diagnostic(diagnostic_info*)
        ???:0
0x283a165 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x285a151 warning(diagnostic_option_id, char const*, ...)
        ???:0
0x182ec08 warn_deprecated_use(tree_node*, tree_node*)
        ???:0
0xbe9749 cp_handle_deprecated_or_unavailable(tree_node*, int)
        ???:0
0xbeaa72 mark_used(tree_node*, int)
        ???:0
0xb17e6e build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0xd899dc finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xd07873 c_parse_file()
        ???:0
0xe6f359 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please see https://godbolt.org/z/P5rvs8ne5

Reply via email to