This patch makes the literal tests run in C, C++98/03, and C++0x mode. I split the type-convert-construct.cpp test into a c++0x piece since expected-error/warning don't understand #ifdefs.
On Wed, Jul 27, 2011 at 8:30 AM, Douglas Gregor <[email protected]> wrote: > > On Jul 27, 2011, at 7:17 AM, Nico Weber wrote: > >> On Tue, Jul 26, 2011 at 10:40 PM, Douglas Gregor <[email protected]> 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 > -- ~Craig
unicode_string_test_fixes.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
