File: 0007-Define-CompareResolution-call-operator-as-const.patch

package info (click to toggle)
briquolo 0.5.7-12
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 9,020 kB
  • sloc: cpp: 17,795; ansic: 8,543; sh: 4,047; makefile: 691; yacc: 288; python: 132; sed: 16
file content (36 lines) | stat: -rw-r--r-- 1,418 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From: "Henrique F. Simoes" <henriquesimoes@riseup.net>
Date: Sat, 4 Oct 2025 17:52:01 -0300
Subject: Define CompareResolution call operator as const

Because this custom comparator is used as constant reference in the
std::set implementation, its methods cannot change its internal state.
Declare that the function call operator doesn't do that, and therefore
can be called whenever we have a constant reference.

This resolves an issue when building with GCC 15, where no matching
method would be found:

/usr/include/c++/15/bits/stl_tree.h:2604:36: error: no match for call to
  ‘(const MOGL_Fenetre::CompareResolution) (const
  MOGL_Fenetre::MOGL_Resolution&, const MOGL_Fenetre ::MOGL_Resolution&)’
MOGL_Fenetre.h:55:14: note: passing ‘const
  MOGL_Fenetre::CompareResolution*’ as ‘this’ argument discards qualifiers

Bug-Debian: https://bugs.debian.org/1096393
---
 src/MOGL/MOGL_Fenetre.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/MOGL/MOGL_Fenetre.h b/src/MOGL/MOGL_Fenetre.h
index cc51f7e..49dd957 100644
--- a/src/MOGL/MOGL_Fenetre.h
+++ b/src/MOGL/MOGL_Fenetre.h
@@ -52,7 +52,7 @@ class MOGL_Fenetre
   private:
     struct CompareResolution
     {
-        bool operator() (const MOGL_Resolution & x, const MOGL_Resolution & y)
+        bool operator() (const MOGL_Resolution & x, const MOGL_Resolution & y) const
         {
           return x.w < y.w;
         }