cxx0x-type-convert-construct.cpp 1.2 KB

123456789101112131415161718192021
  1. // RUN: %clang_cc1 -std=gnu++0x -fsyntax-only -verify %s
  2. void f() {
  3. char *u8str;
  4. u8str = u8"a UTF-8 string"; // expected-error {{assigning to 'char *' from incompatible type 'const char [15]'}}
  5. char16_t *ustr;
  6. ustr = u"a UTF-16 string"; // expected-error {{assigning to 'char16_t *' from incompatible type 'const char16_t [16]'}}
  7. char32_t *Ustr;
  8. Ustr = U"a UTF-32 string"; // expected-error {{assigning to 'char32_t *' from incompatible type 'const char32_t [16]'}}
  9. char *Rstr;
  10. Rstr = "a raw string"; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
  11. wchar_t *LRstr;
  12. LRstr = LR"foo(a wide raw string)foo"; // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}}
  13. char *u8Rstr;
  14. u8Rstr = u8R"foo(a UTF-8 raw string)foo"; // expected-error {{assigning to 'char *' from incompatible type 'const char [19]'}}
  15. char16_t *uRstr;
  16. uRstr = uR"foo(a UTF-16 raw string)foo"; // expected-error {{assigning to 'char16_t *' from incompatible type 'const char16_t [20]'}}
  17. char32_t *URstr;
  18. URstr = UR"foo(a UTF-32 raw string)foo"; // expected-error {{assigning to 'char32_t *' from incompatible type 'const char32_t [20]'}}
  19. }