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

Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arthur.j.odwyer at gmail dot 
com

--- Comment #1 from Arthur O'Dwyer <arthur.j.odwyer at gmail dot com> ---
I don't see this as a bug (and indeed Clang/MSVC reject it too). It's okay to
use the address of `il` itself as the value of a template parameter, because we
know a mangleable name for that; but the address of the first element of the
backing array isn't a valid value for a template parameter, because the backing
array is anonymous — it hasn't got a mangleable name — in the
very-new-like-as-of-last-week Standardese, it's a "potentially non-unique
object." The same rejection applies to this example employing a string literal
(the other kind of "potentially non-unique object") in the Standard
post-CWG2753):

constexpr const char *il = "hello world";
template<auto*> constexpr bool front = true;
static_assert(front<&il>);     // OK
static_assert(front<&il[0]>);  // Reject

So I think this is not-a-bug.
  • [Bug c++/99524] initializer_... arthur.j.odwyer at gmail dot com via Gcc-bugs

Reply via email to