This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] C/C++: don't suggest decls that are being initialized (PR c++/88320)


On 12/5/18 4:29 PM, David Malcolm wrote:
diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h
index 8bfa3f3..8f389e4 100644
--- a/gcc/cp/parser.h
+++ b/gcc/cp/parser.h
@@ -405,6 +405,15 @@ struct GTY(()) cp_parser {
       specification, if any, or UNKNOWN_LOCATION otherwise.  */
    location_t innermost_linkage_specification_location;
+ /* A stack of all variables for which we're currently parsing an initializer.
+     This allows us to prevent offering the decls as suggestions for
+     unrecognized identifiers - following such suggestions would lead to
+     -Wuninitialized warnings.  */
+  vec<tree, va_gc> *decls_being_initialized;
+
+  /* Are we within a mem-initializer-list?  This allows us to prevent
+     offering fields as suggestions for unrecognized identifiers.  */
+  int within_mem_initializer_list;

I don't think cp_parser is the right place for these; they should go in saved_scope instead so that when we push into a template instantiation they are cleared, and then restored when we pop back.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]