[cfe-dev] Checking type conversion possibility
Douglas Gregor
dgregor at apple.com
Mon Dec 17 12:32:01 PST 2012
On Dec 13, 2012, at 8:23 PM, Manjunath Kudlur <keveman at gmail.com> wrote:
> Hello,
>
> If I have 2 QualTypes, FromType and ToType, how do I check if converting an R-value of type FromType to ToType is possible? I see TryCopyInitialization used for something similar, but that needs an Expr* whose type is FromType. Is there a way to create a temporary R-value with a given type? Something akin to llvm::UndefValue::get(Type*) perhaps?
You can use OpaqueValueExpr for this purpose. Just build it with the appropriate type and value kind (lvalue/xvalue/prvalue).
- Doug
More information about the cfe-dev
mailing list