gcc 11 C++20 compilation warning redundant redeclaration of ‘constexpr’ static data member
- Dominant language
- C++
- Stars
- 39.6k
- Forks
- 10.9k
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 1
Description
**Describe the bug**
When compiling Gtest with gcc 11 and C++20 (-std=gnu++20) we have the following compilation warning:
```
include/gmock/internal/gmock-internal-utils.h:504:18: error: redundant redeclaration of ‘constexpr’ static data member ‘testing::internal::Function::ArgumentCount’ [-Werror=deprecated]
504 | constexpr size_t Function::ArgumentCount;
| ^~~~~~~~~~~~~~~~~~~~
/data/mwrep/res/osp/Gmock/21-0-0-0/include/gmock/internal/gmock-internal-utils.h:493:27: note: previous declaration of ‘testing::internal::Function::ArgumentCount’
493 | static constexpr size_t ArgumentCount = sizeof...(Args);
```
**Steps to reproduce the bug**
```
git clone -b master https://github.com/google/googletest.git
cd googletest
mkdir _build
cd _build
cmake ${BuildTarget} \
-Dgtest_build_samples=ON \
-Dgtest_build_tests=ON \
-Dgmock_build_tests=ON \
-DCMAKE_INSTALL_PREFIX=%{buildroot} \
-DCMAKE_PREFIX_PATH:PATH="%{deps_prefix}" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_SKIP_RPATH=OFF \
-DBUILD_GMOCK=ON \
-DINSTALL_GTEST=ON \
-G"Unix Makefiles" ..
make
```
**Does the bug persist in the most recent commit?**
Yes
**What operating system and version are you using?**
Ubuntu 20.04.2 LTS
**What compiler and version are you using?**
g++ (GCC) 11.1.1 20210517
**What build system are you using?**
cmake version 3.16.3
**Additional context**
I think the problem is a pure C++ problem (although I am not sure if it is affect C++20 only, or also older dialect
Contributor guide
Assessment
This issue has not been assessed yet.