[cfe-commits] r47003 - in /cfe/trunk: AST/ASTContext.cpp test/Sema/conditional-expr.c
Eli Friedman
eli.friedman at gmail.com
Tue Feb 12 00:23:07 PST 2008
Author: efriedma
Date: Tue Feb 12 02:23:06 2008
New Revision: 47003
URL: http://llvm.org/viewvc/llvm-project?rev=47003&view=rev
Log:
Fix type compatibility between constant and variable arrays.
Modified:
cfe/trunk/AST/ASTContext.cpp
cfe/trunk/test/Sema/conditional-expr.c
Modified: cfe/trunk/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/AST/ASTContext.cpp?rev=47003&r1=47002&r2=47003&view=diff
==============================================================================
--- cfe/trunk/AST/ASTContext.cpp (original)
+++ cfe/trunk/AST/ASTContext.cpp Tue Feb 12 02:23:06 2008
@@ -1685,6 +1685,10 @@
// comparisons, just force one to the other.
if (LHSClass == Type::FunctionProto) LHSClass = Type::FunctionNoProto;
if (RHSClass == Type::FunctionProto) RHSClass = Type::FunctionNoProto;
+
+ // Same as above for arrays
+ if (LHSClass == Type::VariableArray) LHSClass = Type::ConstantArray;
+ if (RHSClass == Type::VariableArray) RHSClass = Type::ConstantArray;
// If the canonical type classes don't match...
if (LHSClass != RHSClass) {
Modified: cfe/trunk/test/Sema/conditional-expr.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/conditional-expr.c?rev=47003&r1=47002&r2=47003&view=diff
==============================================================================
--- cfe/trunk/test/Sema/conditional-expr.c (original)
+++ cfe/trunk/test/Sema/conditional-expr.c Tue Feb 12 02:23:06 2008
@@ -22,5 +22,10 @@
const int *cip;
vp = (0 ? vp : cip); // expected-warning {{discards qualifiers}}
vp = (0 ? cip : vp); // expected-warning {{discards qualifiers}}
+
+ int i = 2;
+ int (*pf)[2];
+ int (*pv)[i];
+ pf = (i ? pf : pv);
}
More information about the cfe-commits
mailing list