forked from OSchip/llvm-project
It's perfectly fine to see UserDefinedConversion casts when emitting scalar expressions.
llvm-svn: 91686
This commit is contained in:
parent
6f8dba7f9e
commit
b396f43520
|
@ -816,6 +816,7 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
|
||||||
return Builder.CreateBitCast(Src, ConvertType(DestTy));
|
return Builder.CreateBitCast(Src, ConvertType(DestTy));
|
||||||
}
|
}
|
||||||
case CastExpr::CK_NoOp:
|
case CastExpr::CK_NoOp:
|
||||||
|
case CastExpr::CK_UserDefinedConversion:
|
||||||
return Visit(const_cast<Expr*>(E));
|
return Visit(const_cast<Expr*>(E));
|
||||||
|
|
||||||
case CastExpr::CK_BaseToDerived: {
|
case CastExpr::CK_BaseToDerived: {
|
||||||
|
@ -903,7 +904,6 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
|
||||||
return Src;
|
return Src;
|
||||||
}
|
}
|
||||||
|
|
||||||
case CastExpr::CK_UserDefinedConversion:
|
|
||||||
case CastExpr::CK_ConstructorConversion:
|
case CastExpr::CK_ConstructorConversion:
|
||||||
assert(0 && "Should be unreachable!");
|
assert(0 && "Should be unreachable!");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,6 +12,9 @@ S::operator int() {
|
||||||
return 10;
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int f(S s) {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
class X { // ...
|
class X { // ...
|
||||||
public: operator int() { printf("operator int()\n"); return iX; }
|
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();
|
char ch = a; // OK. calls Yb::operator char();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct A {
|
||||||
|
operator int() const;
|
||||||
|
};
|
||||||
|
|
||||||
// CHECK-LP64: .globl __ZN1ScviEv
|
// CHECK-LP64: .globl __ZN1ScviEv
|
||||||
// CHECK-LP64-NEXT: __ZN1ScviEv:
|
// CHECK-LP64-NEXT: __ZN1ScviEv:
|
||||||
|
|
Loading…
Reference in New Issue