c++: Fix null this pointer [PR 98624]
authorNathan Sidwell <nathan@acm.org>
Tue, 19 Jan 2021 19:31:57 +0000 (11:31 -0800)
committerNathan Sidwell <nathan@acm.org>
Tue, 19 Jan 2021 19:37:03 +0000 (11:37 -0800)
There's no need for this function to have an object, so make it
static and avoid UB.

PR c++/98624
gcc/cp/
* module.cc (trees_out::write_location): Make static.

gcc/cp/module.cc

index 1fd0bcfe3eb5ec37f97be0b58a675c09eef4392c..3b224b616c11c7fa7796b882b48e7c9ad4d69f31 100644 (file)
@@ -3727,7 +3727,7 @@ class GTY((chain_next ("%h.parent"), for_user)) module_state {
   static cpp_macro *deferred_macro (cpp_reader *, location_t, cpp_hashnode *);
 
  public:
-  void write_location (bytes_out &, location_t);
+  static void write_location (bytes_out &, location_t);
   location_t read_location (bytes_in &) const;
 
  public: