]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libitm: small update for C++20
authorMarek Polacek <polacek@redhat.com>
Sat, 3 Feb 2024 14:47:17 +0000 (09:47 -0500)
committerMarek Polacek <polacek@redhat.com>
Mon, 5 Feb 2024 15:31:28 +0000 (10:31 -0500)
C++20 DR 2237 disallows simple-template-id in cdtors, so you
can't write

    template<typename T>
    struct S {
      S<T>(); // 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

index 2842fa038eda95bdf75208bba690cf826ad4aec9..4160b16d569695890c8dbd3cba8a50388abb562a 100644 (file)
@@ -48,7 +48,7 @@ class vector
   static const size_t default_resize_min = 32;
 
   // Don't try to copy this vector.
-  vector<T, alloc_separate_cl>(const vector<T, alloc_separate_cl>& x);
+  vector(const vector<T, alloc_separate_cl>& 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<T, alloc_separate_cl>(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<T, alloc_separate_cl>() { if (m_capacity) free(entries); }
+  ~vector() { if (m_capacity) free(entries); }
 
   void resize(size_t additional_capacity)
   {