[cfe-commits] r136210 - in /cfe/trunk: include/clang/AST/ include/clang/Basic/ include/clang/Lex/ include/clang/Parse/ lib/AST/ lib/CodeGen/ lib/Lex/ lib/Parse/ lib/Rewrite/ lib/Sema/ lib/Serialization/ test/CXX/lex/lex.literal/lex.ccon/ test/Cod

Douglas Gregor dgregor at apple.com
Wed Jul 27 08:30:45 PDT 2011


On Jul 27, 2011, at 7:17 AM, Nico Weber wrote:

> On Tue, Jul 26, 2011 at 10:40 PM, Douglas Gregor <dgregor at apple.com> wrote:
>> Author: dgregor
>> Date: Wed Jul 27 00:40:30 2011
>> New Revision: 136210
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=136210&view=rev
>> Log:
>> Add support for C++0x unicode string and character literals, from Craig Topper!
> 
> Cool! One question below.
> 
>> 
>> Modified: cfe/trunk/test/SemaCXX/type-convert-construct.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/type-convert-construct.cpp?rev=136210&r1=136209&r2=136210&view=diff
>> ==============================================================================
>> --- cfe/trunk/test/SemaCXX/type-convert-construct.cpp (original)
>> +++ cfe/trunk/test/SemaCXX/type-convert-construct.cpp Wed Jul 27 00:40:30 2011
>> @@ -1,4 +1,5 @@
>> -// RUN: %clang_cc1 -fsyntax-only -verify %s
>> +// RUN: %clang_cc1 -std=gnu++0x -fsyntax-only -verify %s
>> +// Runs in c++0x mode so that char16_t and char32_t are available.
>> 
>>  void f() {
>>   float v1 = float(1);
>> @@ -14,4 +15,8 @@
>>   str = "a string"; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
>>   wchar_t *wstr;
>>   wstr = L"a wide string"; // expected-warning{{conversion from string literal to 'wchar_t *' is deprecated}}
>> +  char16_t *ustr;
>> +  ustr = u"a UTF-16 string"; // expected-error {{assigning to 'char16_t *' from incompatible type 'const char16_t [16]'}}
>> +  char32_t *Ustr;
>> +  Ustr = U"a UTF-32 string"; // expected-error {{assigning to 'char32_t *' from incompatible type 'const char32_t [16]'}}
>>  }
> 
> Are there any tests left for wide characters in non-c++0x mode? Should there be?

Ah, that's a good point. Yes, there should be. I think the best way to handle this would be to run each of these tests in both C mode and in C++0x mode, and #ifdef away the C++ stuff when we're not in C++ mode. Craig, would you might submitting a patch to do that?

	- Doug



More information about the cfe-commits mailing list