[cfe-commits] r95228 - in /cfe/trunk: lib/Sema/SemaExpr.cpp test/CXX/lex/lex.literal/lex.ccon/p1.cpp

Eli Friedman eli.friedman at gmail.com
Wed Feb 3 10:21:45 PST 2010


Author: efriedma
Date: Wed Feb  3 12:21:45 2010
New Revision: 95228

URL: http://llvm.org/viewvc/llvm-project?rev=95228&view=rev
Log:
Fix for PR6220: compute the correct type for multicharacter literals.


Added:
    cfe/trunk/test/CXX/lex/lex.literal/lex.ccon/p1.cpp
Modified:
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=95228&r1=95227&r2=95228&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Wed Feb  3 12:21:45 2010
@@ -1668,6 +1668,8 @@
     Ty = Context.IntTy;   // 'x' and L'x' -> int in C.
   else if (Literal.isWide())
     Ty = Context.WCharTy; // L'x' -> wchar_t in C++.
+  else if (Literal.isMultiChar())
+    Ty = Context.IntTy;   // 'wxyz' -> int in C++.
   else
     Ty = Context.CharTy;  // 'x' -> char in C++
 

Added: cfe/trunk/test/CXX/lex/lex.literal/lex.ccon/p1.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/lex/lex.literal/lex.ccon/p1.cpp?rev=95228&view=auto

==============================================================================
--- cfe/trunk/test/CXX/lex/lex.literal/lex.ccon/p1.cpp (added)
+++ cfe/trunk/test/CXX/lex/lex.literal/lex.ccon/p1.cpp Wed Feb  3 12:21:45 2010
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// Check types of char literals
+extern char a;
+extern __typeof('a') a;
+extern int b;
+extern __typeof('asdf') b;
+extern wchar_t c;
+extern __typeof(L'a') c;





More information about the cfe-commits mailing list