[cfe-commits] r74808 - in /cfe/trunk: lib/AST/ASTContext.cpp test/SemaCXX/wchar_t.cpp
Eli Friedman
eli.friedman at gmail.com
Sun Jul 5 16:44:31 PDT 2009
Author: efriedma
Date: Sun Jul 5 18:44:27 2009
New Revision: 74808
URL: http://llvm.org/viewvc/llvm-project?rev=74808&view=rev
Log:
Fix for PR4502: add calculation of the integer conversion rank for
wchar_t.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/SemaCXX/wchar_t.cpp
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=74808&r1=74807&r2=74808&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Jul 5 18:44:27 2009
@@ -2245,6 +2245,9 @@
if (EnumType* ET = dyn_cast<EnumType>(T))
T = ET->getDecl()->getIntegerType().getTypePtr();
+ if (T->isSpecificBuiltinType(BuiltinType::WChar))
+ T = getFromTargetType(Target.getWCharType()).getTypePtr();
+
// There are two things which impact the integer rank: the width, and
// the ordering of builtins. The builtin ordering is encoded in the
// bottom three bits; the width is encoded in the bits above that.
Modified: cfe/trunk/test/SemaCXX/wchar_t.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/wchar_t.cpp?rev=74808&r1=74807&r2=74808&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/wchar_t.cpp (original)
+++ cfe/trunk/test/SemaCXX/wchar_t.cpp Sun Jul 5 18:44:27 2009
@@ -7,3 +7,7 @@
signed wchar_t z; // expected-warning {{'wchar_t' cannot be signed or unsigned}}
++x;
}
+
+// PR4502
+wchar_t const c = L'c';
+int a[c == L'c' ? 1 : -1];
More information about the cfe-commits
mailing list