[cfe-dev] Possible fix for codegen bug with cond ? func1 : func2

Ted Kremenek kremenek at apple.com
Fri May 16 12:30:24 PDT 2008


On May 16, 2008, at 12:22 PM, Eli Friedman wrote:

> On Fri, May 16, 2008 at 12:18 PM, Chris Lattner <clattner at apple.com>  
> wrote:
>>> Testcase (currently crashes with clang -emit-llvm):
>>> int a();
>>> int b(int);
>>> int c() {return 1 ? a : b;}
>>
>> Should sema be inserting an implicit cast to the common type?
>
> I suppose that's a possibility; which way are users outside of codegen
> likely to prefer?

An implicit cast is preferable to other clients (the static analyzer  
being one of them).  It puts the logic of such type munging into a  
single place, and makes the invariants of the ASTs more logically  
consistent.



More information about the cfe-dev mailing list