summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorda-woods <dw-git@d-woods.co.uk>2022-11-11 20:32:38 +0000
committerGitHub <noreply@github.com>2022-11-11 20:32:38 +0000
commit323e5c8c7583b6d8be7f3c2540a63283a21c27e6 (patch)
tree48528c366f7b3b628d4e75b0c873d1e0b25a579d
parentf97aa82ce5fb89138ad8c55e0802069774c73b76 (diff)
downloadcython-323e5c8c7583b6d8be7f3c2540a63283a21c27e6.tar.gz
Run GCC 11 tests with the most recent language standard (#5078)
It doesn't look like we're testing with a compiler using up-to-date language standards, and this meant we missed at least one bug recently: https://github.com/cython/cython/pull/5029. It seems like the GCC11 tests may as well double as "GCC11 with up-to-date language standards" * Try to fix fake reference copy-constructor issue
-rw-r--r--.github/workflows/ci.yml6
-rw-r--r--Cython/Utility/ModuleSetupCode.c6
2 files changed, 7 insertions, 5 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ce62f36f3..4dd771ad9 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -63,16 +63,16 @@ jobs:
# Ubuntu sub-jobs:
# ================
- # GCC 11
+ # GCC 11 (with latest language standards)
- os: ubuntu-18.04
python-version: 3.9
backend: c
- env: { GCC_VERSION: 11 }
+ env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c17" }
extra_hash: "-gcc11"
- os: ubuntu-18.04
python-version: 3.9
backend: cpp
- env: { GCC_VERSION: 11 }
+ env: { GCC_VERSION: 11, EXTRA_CFLAGS: "-std=c++20" }
extra_hash: "-gcc11"
# compile all modules
- os: ubuntu-18.04
diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c
index fa16485b5..df2a4ee4a 100644
--- a/Cython/Utility/ModuleSetupCode.c
+++ b/Cython/Utility/ModuleSetupCode.c
@@ -592,8 +592,10 @@ class __Pyx_FakeReference {
T *operator&() { return ptr; }
operator T&() { return *ptr; }
// TODO(robertwb): Delegate all operators (or auto-generate unwrapping code where needed).
- template<typename U> bool operator ==(U other) { return *ptr == other; }
- template<typename U> bool operator !=(U other) { return *ptr != other; }
+ template<typename U> bool operator ==(const U& other) const { return *ptr == other; }
+ template<typename U> bool operator !=(const U& other) const { return *ptr != other; }
+ template<typename U=T> bool operator==(const __Pyx_FakeReference<U>& other) const { return *ptr == *other.ptr; }
+ template<typename U=T> bool operator!=(const __Pyx_FakeReference<U>& other) const { return *ptr != *other.ptr; }
private:
T *ptr;
};