Avoid overloading on 32 bit architectures
authorJames Page james.page@ubuntu.com, Bernd Zeimetz <bzed@debian.org>
Sun, 13 Dec 2020 15:33:57 +0000 (15:33 +0000)
committerThomas Goirand <zigo@debian.org>
Sun, 13 Dec 2020 15:33:57 +0000 (15:33 +0000)
Forwarded: no

unsigned and size_t are equivalent on 32 bit architectures,
so only define the size_t based overload of advance on 64
bit architectures.
https://wiki.debian.org/ArchitectureSpecificsMemo

Gbp-Pq: Name 32bit-avoid-overloading.patch

src/include/buffer.h

index 774ca052268cf478c641f1e46f1c844ef1986498..ef94302decb0e39f13eedf94f99409b6821dc61f 100644 (file)
@@ -737,7 +737,12 @@ inline namespace v14_2_0 {
 
       void advance(int o) = delete;
       void advance(unsigned o);
+
+// unsigned and size_t are equivalent on 32bit architectures.
+// so casting is only needed when not on 32bit.
+#if defined(UINTPTR_MAX) && UINTPTR_MAX > 0xffffffff
       void advance(size_t o) { advance(static_cast<unsigned>(o)); }
+#endif
       void seek(unsigned o);
       char operator*() const;
       iterator_impl& operator++();