Affected subclause: [lex.literal]
Change: Type of UTF-8 string and character literals
. Rationale: Required for new features
. The changed types enable function overloading, template specialization, and
type deduction to distinguish ordinary and UTF-8 string and character literals
. Effect on original feature: Valid C++ 2017 code that depends on
UTF-8 string literals having type “array of
const char” and
UTF-8 character literals having type “
char”
is not valid in this revision of C++
. const auto *u8s = u8"text";
const char *ps = u8s;
auto u8c = u8'c';
char *pc = &u8c;
std::string s = u8"text";
void f(const char *s);
f(u8"text");
template<typename> struct ct;
template<> struct ct<char> {
using type = char;
};
ct<decltype(u8'c')>::type x;