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

            Bug ID: 120534
           Summary: internal compiler error: in adjust_temp_type, at
                    cp/constexpr.cc:1789 since gcc 5.1
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mario.rodriguezb1 at um dot es
  Target Milestone: ---

## Program 

```
#include <iostream>
struct A {
  int x;
  constexpr int getX() const { return x; }
};

constexpr int f() { return 42; }

int main() {
  constexpr A (*const px)() = f;
  static_assert(px().getX() == 42, "");
}
```

## Stack dump 

```
<source>:11:19: internal compiler error: in adjust_temp_type, at
cp/constexpr.cc:1789
   11 |   static_assert(px().getX() == 42, "");
      |                 ~~^~
0x282a0a5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x284b7e6 internal_error(char const*, ...)
        ???:0
0xadd7bc fancy_abort(char const*, int, char const*)
        ???:0
0xb5aad2 maybe_constant_value(tree_node*, tree_node*, mce_value)
        ???:0
0xdd4b2e cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
        ???:0
0xb17eb4 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ???:0
0xdc60d2 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
        ???:0
0xd02d73 c_parse_file()
        ???:0
0xe6aad9 c_common_parse_file()
        ???:0
```

To quickly reproduce:

https://godbolt.org/z/dr3fK94Yf
  • [Bug c++/120534] New: internal... mario.rodriguezb1 at um dot es via Gcc-bugs

Reply via email to