diff options
author | Daniel Dunbar <daniel@zuster.org> | 2008-10-24 08:07:57 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2008-10-24 08:07:57 +0000 |
commit | ac620decb68aad1a2cf6c0c191b56d78981d9aaa (patch) | |
tree | d87362582109d074930a5f790b3c959518f6319c /lib/AST/ExprConstant.cpp | |
parent | d02dae5a210db9a6d7b75a5fe255eab97b261889 (diff) |
PR2919: __builtin_types_compatible_p strips CRV qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58079 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprConstant.cpp')
-rw-r--r-- | lib/AST/ExprConstant.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp index 5bc4170e70..12010646bc 100644 --- a/lib/AST/ExprConstant.cpp +++ b/lib/AST/ExprConstant.cpp @@ -205,7 +205,13 @@ public: } bool VisitTypesCompatibleExpr(const TypesCompatibleExpr *E) { Result.zextOrTrunc(getIntTypeSizeInBits(E->getType())); - Result = Info.Ctx.typesAreCompatible(E->getArgType1(), E->getArgType2()); + // Per gcc docs "this built-in function ignores top level + // qualifiers". We need to use the canonical version to properly + // be able to strip CRV qualifiers from the type. + QualType T0 = Info.Ctx.getCanonicalType(E->getArgType1()); + QualType T1 = Info.Ctx.getCanonicalType(E->getArgType2()); + Result = Info.Ctx.typesAreCompatible(T0.getUnqualifiedType(), + T1.getUnqualifiedType()); return true; } bool VisitDeclRefExpr(const DeclRefExpr *E); |