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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|---                         |INVALID

--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
This code is invalid for a few different reasons.

First std::string_view is not a valid type for a template non-type parameter 
because it is not structural.

Second "" is not valid either.

clang reports as:
<source>:17:23: error: pointer to subobject of string literal is not allowed in
a template argument


For:
```

#include <string_view>
//using namespace std::string_view_literals;

struct sv
{
  const char *d;
  size_t len;
  template <size_t l>
  constexpr sv(const char (&t)[l]) : d(t), len(l) {};
};

typedef std::string_view t;

template<sv> struct test_type {};

auto test = test_type<sv("")>{};
```

Reply via email to