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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase:
// C++26 P1306R5 - Expansion statements
// { dg-do run { target c++14 } }
// { dg-require-weak "" }
// { dg-options "" }

struct A
{
  int x;
  constexpr explicit A (int v) : x(v) {}
  constexpr A &operator ++ () { ++x; return *this; }
  constexpr int operator * () const { return x; }
  constexpr bool operator != (const A &o) const { return x != o.x; }
  constexpr A operator + (int o) const { A r (x + o); return r; }
  constexpr int operator - (const A &o) const { return x - o.x; }
};

namespace N
{
  struct B { constexpr B () {} };
  constexpr A begin (const B &) { return A (0); }
  constexpr A end (const B &) { return A (6); }
}

int
bar ()
{
  int r = 0;
  template for (constexpr auto i : N::B {})                     // { dg-warning
"'template for' only available with" "" { target c++23_down } }
    r += i;
  return r;
}

extern void plugh ();

[[gnu::weakref ("plugh")]] static void xyzzy ();

void
plugh ()
{
}

This ICEs even on x86_64-linux.  The reason for the ICE on p3491-2.C on just
some targets and not others is whether weakrefs appear in the IL or not.  If
they do, gcc attempts to construct assembler_name_hash and tries to mangle even
the nameless expansion stmt decls.

Reply via email to