On Tue, Feb 17, 2009 at 2:03 PM, Eli Friedman <[email protected]> wrote: > On Tue, Feb 17, 2009 at 10:43 AM, Daniel Dunbar <[email protected]> wrote: >> IRgen no longer relies on isConstantInitializer, instead we just try >> to emit the constant. If that fails then in C we emit an error >> unsupported (this occurs when Sema accepted something that it doesn't >> know how to fold, and IRgen doesn't know how to emit) and in C++ we >> emit a guarded initializer. > > Any such cases are bugs in isConstantInitializer/Evaluate, IMO. As I > said in PR3398, the only interesting case I know of here is pointers > cast to integers, which Evaluate doesn't handle.
Agreed. However, IRgen should have this structure anyway since we want to try and emit C++ initializers as constants; and there is no reason to do two traversals of the expression (one for isConstantInitializer and another to actually emit it). The error unsupported should be replaced with an assert when Evaluate takes everything, I think. Really, there is no need for isConstantInitializer, since it should return true for C, and is irrelevant for C++, right? - Daniel _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
