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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |8.5
                 CC|                            |jakub at gcc dot gnu.org
           Priority|P3                          |P2
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-03-26
            Summary|internal compiler error: in |[8/9/10/11 Regression]
                   |expand_expr_real_2          |internal compiler error: in
                   |                            |expand_expr_real_2

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Original testcase (we always want them in bugzilla rather than some external
site):
#include <iostream>
#include <string_view>
#include <array>

template<typename T>
struct Variable{
    std::string_view name;
    void (*set)(T*);
};

struct test{
    int var=0;

    struct metadata{
        static constexpr std::array<Variable<test>, 1> fields{
            Variable<test>{"var", 
                [](test* obj){obj->*(&test::var)=42;}
            }};
    };
};


int main(){
    test t;

    test::metadata::fields[0].set(&t);

    std::cout << t.var << "\n";
}

Reduced:
struct a {
  constexpr a(const char *) : b{}, c{} {}
  long b;
  char c;
};
using d = a;
struct e;
struct f;
template <int> struct m { typedef e g; };
template <int h> struct o {
  typename m<h>::g i;
  void operator[](long) const;
};
struct e {
  d j;
  void (*k)(f *);
};
struct f {
  int l;
  struct p {
    static constexpr o<1> fields{"", [](f *n) { n->*&f::l = 2; }};
  };
};
int main() { f::p::fields[0]; }

With -std=c++1z started to ICE with
r7-3811-g253abb2a156c6ea7d1631bbe9da32070fdfe901b

Reply via email to