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

            Bug ID: 123866
           Summary: ICE when calling annotations_of on member function.
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jeppreston at gmail dot com
  Target Milestone: ---

Created attachment 63516
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63516&action=edit
Preprocessed snippet.

This snippet:

```
#include <meta>

struct example
{
    [[=1]]
    auto function1() -> void
    {};
};

auto main() -> int
{
    static_assert(annotations_of(^^example::function1).empty());
};
```

Causes the following ICE:

```
source/main.cpp: In function ‘int main()’:
source/main.cpp:12:33: internal compiler error: in eval_annotations_of, at
cp/reflect.cc:3791
   12 |     static_assert(annotations_of(^^example::function1).empty());
      |                   ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
0x2b4deff internal_error(char const*, ...)
        ../../trunk/gcc/diagnostic-global-context.cc:787
0xba25bf fancy_abort(char const*, int, char const*)
        ../../trunk/gcc/diagnostics/context.cc:1812
0x8f33b6 eval_annotations_of
        ../../trunk/gcc/cp/reflect.cc:3791
0xe8d353 process_metafunction(constexpr_ctx const*, tree_node*, tree_node*,
bool*, bool*, tree_node**)
        ../../trunk/gcc/cp/reflect.cc:7932
0xc0ea05 cxx_eval_call_expression
        ../../trunk/gcc/cp/constexpr.cc:3867
0xc123b0 cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
        ../../trunk/gcc/cp/constexpr.cc:9205
0xc15262 cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
        ../../trunk/gcc/cp/constexpr.cc:9342
0xc133c5 cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
        ../../trunk/gcc/cp/constexpr.cc:9623
0xc0ef74 cxx_bind_parameters_in_call
        ../../trunk/gcc/cp/constexpr.cc:2757
0xc0ef74 cxx_eval_call_expression
        ../../trunk/gcc/cp/constexpr.cc:4087
0xc123b0 cxx_eval_constant_expression(constexpr_ctx const*, tree_node*,
value_cat, bool*, bool*, tree_node**)
        ../../trunk/gcc/cp/constexpr.cc:9205
0xc24177 cxx_eval_outermost_constant_expr
        ../../trunk/gcc/cp/constexpr.cc:10717
0xc2b8c7 maybe_constant_value(tree_node*, tree_node*, mce_value)
        ../../trunk/gcc/cp/constexpr.cc:11139
0xeb1431 finish_static_assert(tree_node*, tree_node*, unsigned long, bool,
bool, bool)
        ../../trunk/gcc/cp/semantics.cc:12902
0xdf51ae cp_parser_declaration_statement
        ../../trunk/gcc/cp/parser.cc:16864
0xdb8007 cp_parser_statement
        ../../trunk/gcc/cp/parser.cc:14429
0xdbb870 cp_parser_statement_seq_opt
        ../../trunk/gcc/cp/parser.cc:15010
0xdbbb5f cp_parser_compound_statement
        ../../trunk/gcc/cp/parser.cc:14857
0xdeb335 cp_parser_function_body
        ../../trunk/gcc/cp/parser.cc:28728
0xdeb335 cp_parser_ctor_initializer_opt_and_function_body
        ../../trunk/gcc/cp/parser.cc:28779
```

Reply via email to