https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99452
--- Comment #1 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
Here's another:
using value_t = unsigned long;
unsigned obj;
constinit value_t failed
= reinterpret_cast<value_t> (&obj) + (11 << 0);
constinit value_t accepted
= reinterpret_cast<value_t> (&obj) + (11);
bester:309>gcc-current/bin/g++ -c -std=gnu++20 r.ii
r.ii:5:19: error: ‘constinit’ variable ‘failed’ does not have a constant
initializer
5 | constinit value_t failed
| ^~~~~~
r.ii:6:5: error: conversion from pointer type ‘unsigned int*’ to arithmetic
type ‘value_t’ {aka ‘long unsigned int’} in a constant expression
6 | = reinterpret_cast<value_t> (&obj) + (11 << 0);