diff options
author | Marek Polacek <polacek@redhat.com> | 2021-01-11 11:44:36 -0500 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2021-01-11 22:31:39 -0500 |
commit | 814299a9d49c25ae2e8d00ec619559b71833871a (patch) | |
tree | 0594e03748425e7d1acd2b9af0fc040ab26adb14 /gcc/cp/typeck2.c | |
parent | 240f0a490dae0fb9ef72fa21a93e8088d17fb682 (diff) | |
download | gcc-814299a9d49c25ae2e8d00ec619559b71833871a.zip gcc-814299a9d49c25ae2e8d00ec619559b71833871a.tar.gz gcc-814299a9d49c25ae2e8d00ec619559b71833871a.tar.bz2 |
c++: -Wmissing-field-initializers in unevaluated ctx [PR98620]
This PR wants us not to warn about missing field initializers when
the code in question takes places in decltype and similar. Fixed
thus.
gcc/cp/ChangeLog:
PR c++/98620
* typeck2.c (process_init_constructor_record): Don't emit
-Wmissing-field-initializers warnings in unevaluated contexts.
gcc/testsuite/ChangeLog:
PR c++/98620
* g++.dg/warn/Wmissing-field-initializers-2.C: New test.
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r-- | gcc/cp/typeck2.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index e50d5fe..93744fd 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -1563,6 +1563,7 @@ process_init_constructor_record (tree type, tree init, int nested, int flags, /* Warn when some struct elements are implicitly initialized. */ if ((complain & tf_warning) + && !cp_unevaluated_operand && !EMPTY_CONSTRUCTOR_P (init)) warning (OPT_Wmissing_field_initializers, "missing initializer for member %qD", field); @@ -1593,6 +1594,7 @@ process_init_constructor_record (tree type, tree init, int nested, int flags, /* Warn when some struct elements are implicitly initialized to zero. */ if ((complain & tf_warning) + && !cp_unevaluated_operand && !EMPTY_CONSTRUCTOR_P (init)) warning (OPT_Wmissing_field_initializers, "missing initializer for member %qD", field); |