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

--- Comment #7 from Net Can <netcan1996 at gmail dot com> ---
here is my use case:
https://github.com/netcan/config-loader/blob/master/include/config-loader/serialize/TypeSerializer.h

the key is
```c++
#define TYPE_SERIALIZER(_type, _typeName)                 \
    struct TypeSerializer<PARE _type>                     \
    { static constexpr decltype(auto) name = _typeName; }

template<> TYPE_SERIALIZER((int8_t), "int8_t"); // (1)

template<typename T>
TYPE_SERIALIZER((std::vector<T>),
                    concat("vector<", TypeSerializer<T>::name, ">")); // (2)
```

in case (1), the `name` type is `const char(&)[N]`, but in case(2), the `name`
type is `array[N]`, so I use `decltype(auto)` rather `auto`, becase latter
loses char length info.

I tried `static decltype(auto)` not work because it is defined in class, and
requires `constexpr`.

Reply via email to