template<typename T>
class X;
int main() {
X<decltype("")> x;
}
Why does g++ deduce T
as const char (&)[1]
and not simply const char[1]
?
Unlike every other literal that is an rvalue, string literals are lvalues. decltype
applied to an lvalue expression gives you a reference so const char (&)[1]
is the correct behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With