There is no such thing as typeinfo for a cv-qualified type. Assert
that this is true when mangling, then fix up the various places in
Sema and/or CodeGen that need to remove qualifiers. Addresses a
linking issue when building LLVM with Clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92064 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index afb5c54..06f8e7a 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -137,8 +137,15 @@
/// CheckCXXThrowOperand - Validate the operand of a throw.
bool Sema::CheckCXXThrowOperand(SourceLocation ThrowLoc, Expr *&E) {
// C++ [except.throw]p3:
- // [...] adjusting the type from "array of T" or "function returning T"
- // to "pointer to T" or "pointer to function returning T", [...]
+ // A throw-expression initializes a temporary object, called the exception
+ // object, the type of which is determined by removing any top-level
+ // cv-qualifiers from the static type of the operand of throw and adjusting
+ // the type from "array of T" or "function returning T" to "pointer to T"
+ // or "pointer to function returning T", [...]
+ if (E->getType().hasQualifiers())
+ ImpCastExprToType(E, E->getType().getUnqualifiedType(), CastExpr::CK_NoOp,
+ E->isLvalue(Context) == Expr::LV_Valid);
+
DefaultFunctionArrayConversion(E);
// If the type of the exception would be an incomplete type or a pointer