Re: [PATCH] libitm: small update for C++20

2024-02-05 Thread Jason Merrill

On 2/3/24 10:14, Marek Polacek wrote:

Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?


OK.


-- >8 --
C++20 DR 2237 disallows simple-template-id in cdtors, so you
can't write

 template
 struct S {
   S(); // should be S();
 };

This hasn't been a problem until now but I'm adding a warning about it
to -Wc++20-compat which libitm apparently uses.

libitm/ChangeLog:

* containers.h (vector): Remove the template-id in constructors.
---
  libitm/containers.h | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libitm/containers.h b/libitm/containers.h
index 2842fa038ed..4160b16d569 100644
--- a/libitm/containers.h
+++ b/libitm/containers.h
@@ -48,7 +48,7 @@ class vector
static const size_t default_resize_min = 32;
  
// Don't try to copy this vector.

-  vector(const vector& x);
+  vector(const vector& x);
  
   public:

typedef T datatype;
@@ -59,7 +59,7 @@ class vector
T& operator[] (size_t pos) { return entries[pos]; }
const T& operator[] (size_t pos) const  { return entries[pos]; }
  
-  vector(size_t initial_size = default_initial_capacity)

+  vector(size_t initial_size = default_initial_capacity)
  : m_capacity(initial_size),
m_size(0)
{
@@ -68,7 +68,7 @@ class vector
  else
entries = 0;
}
-  ~vector() { if (m_capacity) free(entries); }
+  ~vector() { if (m_capacity) free(entries); }
  
void resize(size_t additional_capacity)

{

base-commit: 78005c648921899a674d1e561b49b05ccabedfe0




[PATCH] libitm: small update for C++20

2024-02-03 Thread Marek Polacek
Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?

-- >8 --
C++20 DR 2237 disallows simple-template-id in cdtors, so you
can't write

template
struct S {
  S(); // should be S();
};

This hasn't been a problem until now but I'm adding a warning about it
to -Wc++20-compat which libitm apparently uses.

libitm/ChangeLog:

* containers.h (vector): Remove the template-id in constructors.
---
 libitm/containers.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libitm/containers.h b/libitm/containers.h
index 2842fa038ed..4160b16d569 100644
--- a/libitm/containers.h
+++ b/libitm/containers.h
@@ -48,7 +48,7 @@ class vector
   static const size_t default_resize_min = 32;
 
   // Don't try to copy this vector.
-  vector(const vector& x);
+  vector(const vector& x);
 
  public:
   typedef T datatype;
@@ -59,7 +59,7 @@ class vector
   T& operator[] (size_t pos) { return entries[pos]; }
   const T& operator[] (size_t pos) const  { return entries[pos]; }
 
-  vector(size_t initial_size = default_initial_capacity)
+  vector(size_t initial_size = default_initial_capacity)
 : m_capacity(initial_size),
   m_size(0)
   {
@@ -68,7 +68,7 @@ class vector
 else
   entries = 0;
   }
-  ~vector() { if (m_capacity) free(entries); }
+  ~vector() { if (m_capacity) free(entries); }
 
   void resize(size_t additional_capacity)
   {

base-commit: 78005c648921899a674d1e561b49b05ccabedfe0
-- 
2.43.0