зеркало из https://github.com/microsoft/clang-1.git
It's perfectly fine to see UserDefinedConversion casts when emitting scalar expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91686 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
ec387afb60
Коммит
0ddb6f7506
|
@ -816,6 +816,7 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
|
|||
return Builder.CreateBitCast(Src, ConvertType(DestTy));
|
||||
}
|
||||
case CastExpr::CK_NoOp:
|
||||
case CastExpr::CK_UserDefinedConversion:
|
||||
return Visit(const_cast<Expr*>(E));
|
||||
|
||||
case CastExpr::CK_BaseToDerived: {
|
||||
|
@ -903,7 +904,6 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
|
|||
return Src;
|
||||
}
|
||||
|
||||
case CastExpr::CK_UserDefinedConversion:
|
||||
case CastExpr::CK_ConstructorConversion:
|
||||
assert(0 && "Should be unreachable!");
|
||||
break;
|
||||
|
|
|
@ -12,6 +12,9 @@ S::operator int() {
|
|||
return 10;
|
||||
}
|
||||
|
||||
int f(S s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
class X { // ...
|
||||
public: operator int() { printf("operator int()\n"); return iX; }
|
||||
|
@ -94,6 +97,9 @@ void f(Yb& a) {
|
|||
char ch = a; // OK. calls Yb::operator char();
|
||||
}
|
||||
|
||||
struct A {
|
||||
operator int() const;
|
||||
};
|
||||
|
||||
// CHECK-LP64: .globl __ZN1ScviEv
|
||||
// CHECK-LP64-NEXT: __ZN1ScviEv:
|
||||
|
|
Загрузка…
Ссылка в новой задаче