c++17 u8 character literals testcase

This commit is contained in:
William S Fulton 2019-02-10 16:45:03 +00:00
commit 21c0d59ae2
2 changed files with 20 additions and 1 deletions

View file

@ -164,6 +164,7 @@ CPP_TEST_CASES += \
cpp_typedef \
cpp17_nested_namespaces \
cpp17_nspace_nested_namespaces \
cpp17_u8_char_literals \
curiously_recurring_template_pattern \
default_args \
default_arg_expressions \

View file

@ -1,8 +1,26 @@
%module cpp17_u8_char_literals
%inline %{
// Tests are designed so that code compiles with C++98 compilers
%{
#if __cplusplus >= 201703L
#define CPP17 1
#endif
%}
// UTF-8 character literals will (apparently) have type char8_t in C++20.
char a = u8'a';
char u = u8'u';
char u8 = u8'8';
%{
#if defined(CPP17)
char a = u8'a';
char u = u8'u';
char u8 = u8'8';
#else
char a = 'a';
char u = 'u';
char u8 = '8';
#endif
%}