[cfe-commits] r91686 - in /cfe/trunk: lib/CodeGen/CGExprScalar.cpp test/CodeGenCXX/conversion-function.cpp
Anders Carlsson
andersca at mac.com
Fri Dec 18 06:42:04 PST 2009
Author: andersca
Date: Fri Dec 18 08:42:03 2009
New Revision: 91686
URL: http://llvm.org/viewvc/llvm-project?rev=91686&view=rev
Log:
It's perfectly fine to see UserDefinedConversion casts when emitting scalar expressions.
Modified:
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/test/CodeGenCXX/conversion-function.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=91686&r1=91685&r2=91686&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Fri Dec 18 08:42:03 2009
@@ -816,6 +816,7 @@
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 @@
return Src;
}
- case CastExpr::CK_UserDefinedConversion:
case CastExpr::CK_ConstructorConversion:
assert(0 && "Should be unreachable!");
break;
Modified: cfe/trunk/test/CodeGenCXX/conversion-function.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/conversion-function.cpp?rev=91686&r1=91685&r2=91686&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/conversion-function.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/conversion-function.cpp Fri Dec 18 08:42:03 2009
@@ -12,6 +12,9 @@
return 10;
}
+int f(S s) {
+ return s;
+}
class X { // ...
public: operator int() { printf("operator int()\n"); return iX; }
@@ -94,6 +97,9 @@
char ch = a; // OK. calls Yb::operator char();
}
+struct A {
+ operator int() const;
+};
// CHECK-LP64: .globl __ZN1ScviEv
// CHECK-LP64-NEXT: __ZN1ScviEv:
More information about the cfe-commits
mailing list