[Bug c++/98933] P0784R7 example support: constexpr new
markus.kuehni at triviso dot ch
gcc-bugzilla@gcc.gnu.org
Tue Feb 2 14:43:14 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98933
--- Comment #4 from Mark <markus.kuehni at triviso dot ch> ---
So this is the only way?
```
#include <memory>
template<typename T> struct S {
std::size_t sz;
T *ps;
template<std::size_t N>
constexpr S(T (&p)[N]) :
sz { N }, ps {p} {}
};
static constexpr char buf[] {"Hello"};
constexpr S str(buf);
// str ends up pointing to a static array
// containing the string "Hello!".
```
More information about the Gcc-bugs
mailing list