Message ID | 20230601031819.1271768-1-jason@redhat.com |
---|---|
State | New |
Headers | show |
Series | [pushed] c++: make -fpermissive avoid -Werror=narrowing | expand |
diff --git a/gcc/cp/typeck2.cc b/gcc/cp/typeck2.cc index 8724877058f..1c204c8612b 100644 --- a/gcc/cp/typeck2.cc +++ b/gcc/cp/typeck2.cc @@ -1109,7 +1109,8 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain, else if (complain & tf_error) { int savederrorcount = errorcount; - global_dc->pedantic_errors = 1; + if (!flag_permissive) + global_dc->pedantic_errors = 1; auto s = make_temp_override (global_dc->dc_warn_system_headers, true); pedwarn (loc, OPT_Wnarrowing, "narrowing conversion of %qE from %qH to %qI",