diff options
-rw-r--r-- | AST/ASTContext.cpp | 4 | ||||
-rw-r--r-- | test/Sema/conditional-expr.c | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/AST/ASTContext.cpp b/AST/ASTContext.cpp index 6eae4584d5..dd8a9d4ecf 100644 --- a/AST/ASTContext.cpp +++ b/AST/ASTContext.cpp @@ -1685,6 +1685,10 @@ bool ASTContext::typesAreCompatible(QualType lhs, QualType rhs) { // 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) { diff --git a/test/Sema/conditional-expr.c b/test/Sema/conditional-expr.c index 0c9052845c..a24846ac1d 100644 --- a/test/Sema/conditional-expr.c +++ b/test/Sema/conditional-expr.c @@ -22,5 +22,10 @@ void foo() { 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); } |