diff mbox series

c++: Fix null this pointer [PR 98624]

Message ID 363e63bd-6cd4-86d5-67da-386ad7ca0cda@acm.org
State New
Headers show
Series c++: Fix null this pointer [PR 98624] | expand

Commit Message

Nathan Sidwell Jan. 19, 2021, 7:35 p.m. UTC
There's no need for this function to have an object, so	make it
static and avoid UB.

	gcc/cp/
         * module.cc (trees_out::write_location): Make static.
diff mbox series

Patch

diff --git i/gcc/cp/module.cc w/gcc/cp/module.cc
index 1fd0bcfe3eb..3b224b616c1 100644
--- i/gcc/cp/module.cc
+++ w/gcc/cp/module.cc
@@ -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: