pr47963.C
227 Bytes
-
re PR c++/57891 (No diagnostic of narrowing conversion in non-type template argument) · ed4f2c00
PR c++/57891 * call.c (struct conversion): Add check_narrowing_const_only. (build_converted_constant_expr): Set check_narrowing and check_narrowing_const_only. Give error if expr is error node. (convert_like_real): Pass it to check_narrowing. * cp-tree.h (check_narrowing): Add a default parameter. * decl.c (compute_array_index_type): Use input_location instead of location_of. * pt.c (convert_nontype_argument): Return NULL_TREE if tf_error. * typeck2.c (check_narrowing): Don't warn for instantiation-dependent expressions. Call maybe_constant_value instead of fold_non_dependent_expr. Don't mention { } in diagnostic. Only check narrowing for constants if CONST_ONLY. * g++.dg/cpp0x/Wnarrowing6.C: New test. * g++.dg/cpp0x/Wnarrowing7.C: New test. * g++.dg/cpp0x/Wnarrowing8.C: New test. * g++.dg/cpp0x/Wnarrowing9.C: New test. * g++.dg/cpp0x/Wnarrowing10.C: New test. * g++.dg/cpp0x/constexpr-47969.C: Adjust dg-error. * g++.dg/cpp0x/constexpr-ex2.C: Likewise. * g++.dg/cpp0x/constexpr-targ.C: Likewise. * g++.dg/cpp0x/scoped_enum2.C: Likewise. * g++.dg/ext/stmtexpr15.C: Likewise. * g++.dg/gomp/pr47963.C: Likewise. * g++.dg/init/new37.C: Likewise. * g++.dg/init/new43.C: Likewise. * g++.dg/other/fold1.C: Likewise. * g++.dg/parse/array-size2.C: Likewise. * g++.dg/template/dependent-name3.C: Likewise. * g++.dg/cpp0x/constexpr-data2.C: Add dg-error. * g++.dg/other/vrp1.C: Likewise. * g++.dg/template/char1.C: Likewise. From-SVN: r263523
Marek Polacek committed