Reviewers: , Message: Diff at http://codereview.appspot.com/download/issue4698047_7001.diff, but the up to date version will always be at http://codereview.appspot.com/4698047.
Description: This patch implements as much of the narrowing conversion error specified by [dcl.init.list] as is possible without generalized initializer lists or full constant expression support, and emits a c++0x-compat warning in C++98 mode. I haven't done much with this code before, so let me know if there are better ways to do pieces of this, or if I've attached the logic in completely the wrong place. The FixIt currently uses a typedef's basename without qualification, which is likely to be incorrect on some code. I'm not sure I'll need anything more correct to clean up Google's codebase, but if you want me to fix it up I'd like to do that in a separate change. The "has the same value after a round-trip through another type" logic is messier than I'd like, but cleaning it up appears to need more methods on types like APInt and APFloat, which I'd like to postpone until another change too. If I'm just missing existing facilities, please point them out. Because I named the CXX0xCompat DiagGroup, I migrated all the existing c++-compat warnings to it, which fixed the names of two of the warnings. The warning is on by default, but it's quite noisy on existing C++98 codebases. Let me know if it should be off by default. The diagnostics for constants that can't be narrowed include strings like "Int: 999" for APValues. We should fix this by adding an operator<<(Diag, APValue) overload, but again, in another change. Please review this at http://codereview.appspot.com/4698047/ Affected files: M include/clang/Basic/DiagnosticGroups.td M include/clang/Basic/DiagnosticSemaKinds.td M include/clang/Sema/Initialization.h M include/clang/Sema/Sema.h M lib/Sema/SemaInit.cpp A test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp M test/Parser/objc-init.m M test/SemaTemplate/instantiate-c99.cpp M test/SemaTemplate/instantiate-expr-4.cpp _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
