mirror of
https://github.com/void-linux/void-packages.git
synced 2025-06-05 06:33:50 +02:00
source-highlight: patch for gcc-12
This commit is contained in:
parent
ccc5060b87
commit
a9bba7faa0
1 changed files with 81 additions and 0 deletions
81
srcpkgs/source-highlight/patches/gcc-12.patch
Normal file
81
srcpkgs/source-highlight/patches/gcc-12.patch
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
From ab9fe5cb9b85c5afab94f2a7f4b6d7d473c14ee9 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Sergei Trofimovich <slyich@gmail.com>
|
||||||
|
Date: Mon, 8 Nov 2021 23:30:42 +0000
|
||||||
|
Subject: Fix tests build failure on clang and gcc-12
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
Both gcc-12 and clang can't find ostream<<(..., std::pair<...>)
|
||||||
|
overload when compile lib/tests/test_wordtokenizer_main.cpp and
|
||||||
|
fail as:
|
||||||
|
|
||||||
|
./../srchilite/tostringcollection.h:103:9:
|
||||||
|
error no match for «operator<<» (operand types are «std::ostringstream»
|
||||||
|
{aka «std::__cxx11::basic_ostringstream<char>»}
|
||||||
|
and «const std::pair<std::__cxx11::basic_string<char>,
|
||||||
|
std::__cxx11::basic_string<char> >»)
|
||||||
|
103 | buf << (*it);
|
||||||
|
| ~~~~^~~~~~~~
|
||||||
|
|
||||||
|
We fix it by placing overload to std namespace where std::pair<...>
|
||||||
|
is defined to make ADL work predictably.
|
||||||
|
|
||||||
|
clang also has a trouble compiling lib/tests/stdboosterror.h as:
|
||||||
|
|
||||||
|
./stdboosterror.h:7:72: error: parameter declarator cannot be qualified
|
||||||
|
std_boost_exception(boost::regex_error(boost::regex_constants::error_bad_pattern));
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~^
|
||||||
|
|
||||||
|
gcc compiles it by accident: https://gcc.gnu.org/PR86564
|
||||||
|
|
||||||
|
Let's disambiguate syntax by making it an explicit constructor call.
|
||||||
|
---
|
||||||
|
lib/tests/stdboosterror.h | 2 +-
|
||||||
|
lib/tests/test_wordtokenizer_main.cpp | 10 ++++++++++
|
||||||
|
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/lib/tests/stdboosterror.h b/lib/tests/stdboosterror.h
|
||||||
|
index 568545b..d59bfa6 100644
|
||||||
|
--- a/lib/tests/stdboosterror.h
|
||||||
|
+++ b/lib/tests/stdboosterror.h
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
#include <boost/regex/pattern_except.hpp>
|
||||||
|
|
||||||
|
static boost::regex_error
|
||||||
|
- std_boost_exception(boost::regex_error(boost::regex_constants::error_bad_pattern));
|
||||||
|
+ std_boost_exception = boost::regex_error(boost::regex_constants::error_bad_pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns the string representing a standard exception (which
|
||||||
|
diff --git a/lib/tests/test_wordtokenizer_main.cpp b/lib/tests/test_wordtokenizer_main.cpp
|
||||||
|
index 40e23b1..11ba389 100644
|
||||||
|
--- a/lib/tests/test_wordtokenizer_main.cpp
|
||||||
|
+++ b/lib/tests/test_wordtokenizer_main.cpp
|
||||||
|
@@ -11,6 +11,14 @@
|
||||||
|
using namespace std;
|
||||||
|
using namespace srchilite;
|
||||||
|
|
||||||
|
+/*
|
||||||
|
+ * We have to use 'std' namespaces because 'WordTokenizer::WordTokenizerResults::value_type'
|
||||||
|
+ * is an std::pair<std::string, std::string> in disguise. We have to place 'operator<<()'
|
||||||
|
+ * into the same namespace for ADL to work. Otherwise gcc-12 or clang-13 can't find the
|
||||||
|
+ * overload.
|
||||||
|
+ */
|
||||||
|
+namespace std {
|
||||||
|
+
|
||||||
|
static ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::value_type &);
|
||||||
|
|
||||||
|
ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::value_type &token) {
|
||||||
|
@@ -23,6 +31,8 @@ ostream &operator <<(ostream &os, const WordTokenizer::WordTokenizerResults::val
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int main() {
|
||||||
|
WordTokenizer::WordTokenizerResults tokens;
|
||||||
|
|
||||||
|
--
|
||||||
|
cgit v1.1
|
||||||
|
|
Loading…
Add table
Reference in a new issue