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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2020-04-07 00:00:00         |2021-8-23

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the cleaned up reduced testcase is rejected by clang but a slight change
can allow it to be accepted:
Change the using Bn line to be:
using Bn = B< A{'\x0a'} >;

I don't know if it was valid without the A there or not.

Also here is a further reduction, the operators don't make a difference.
Also this is a more portable testcase which also shows what is going on easier.


#define element 0
#define value 1
#define altelement (element+1)

#define r (value)|((element)<<4)
#define r1 (value)|((altelement)<<4)

struct A {
  unsigned data [16] {};
  constexpr A (unsigned ch) { data[(ch>>4)&0xf] = (ch&0xf); }
};
template <A chars> struct B {  };
void
check (A a)
{
  for (int i = 0; i < 16; i++)
    if ((unsigned) a.data[i] != (i == element ? value : 0))
      __builtin_abort ();
}
using Bn = B<A{r1}>;
template <A T> void foo () {  check (T); }
int
main ()
{
  foo<r> ();
  check (A{r});
}

Reply via email to