diff options
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r-- | clang/lib/AST/ByteCode/Compiler.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index eafe735..86b4358 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -3629,15 +3629,22 @@ template <class Emitter> bool Compiler<Emitter>::VisitCXXTypeidExpr(const CXXTypeidExpr *E) { const Type *TypeInfoType = E->getType().getTypePtr(); + auto canonType = [](const Type *T) { + return T->getCanonicalTypeUnqualified().getTypePtr(); + }; + if (!E->isPotentiallyEvaluated()) { if (DiscardResult) return true; if (E->isTypeOperand()) return this->emitGetTypeid( - E->getTypeOperand(Ctx.getASTContext()).getTypePtr(), TypeInfoType, E); - return this->emitGetTypeid(E->getExprOperand()->getType().getTypePtr(), - TypeInfoType, E); + canonType(E->getTypeOperand(Ctx.getASTContext()).getTypePtr()), + TypeInfoType, E); + + return this->emitGetTypeid( + canonType(E->getExprOperand()->getType().getTypePtr()), TypeInfoType, + E); } // Otherwise, we need to evaluate the expression operand. |