Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile with gcc-7.4.0 #1975

Closed
david8dixon opened this issue Jul 6, 2020 · 7 comments
Closed

Can't compile with gcc-7.4.0 #1975

david8dixon opened this issue Jul 6, 2020 · 7 comments

Comments

@david8dixon
Copy link

Describe the bug
I am compiling the following test with gcc 7.3.0:

#define CATCH_CONFIG_MAIN
#include "catch2/catch.hpp"
SCENARIO("test"){} 

In file included from gcc/7.3.0/include/c++/7.3.0/powerpc64le-unknown-linux-gnu/bits/c++allocator.h:33:0,
from gcc/7.3.0/include/c++/7.3.0/bits/allocator.h:46,
from gcc/7.3.0/include/c++/7.3.0/string:41,
from build/_deps/catch-src/single_include/catch2/catch.hpp:481,
from test.cpp:3:
gcc/7.3.0/include/c++/7.3.0/ext/new_allocator.h: In instantiation of ‘void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = Catch::Config; _Args = {Catch::ConfigData&}; _Tp = Catch::Config]’:
gcc/7.3.0/include/c++/7.3.0/bits/alloc_traits.h:475:4: required from ‘static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = Catch::Config; _Args = {Catch::ConfigData&}; _Tp = Catch::Config; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocatorCatch::Config]’
gcc/7.3.0/include/c++/7.3.0/bits/shared_ptr_base.h:526:39: required from ‘std::_Sp_counted_ptr_inplace<_Tp, _Alloc, _Lp>::_Sp_counted_ptr_inplace(_Alloc, _Args&& ...) [with _Args = {Catch::ConfigData&}; _Tp = Catch::Config; _Alloc = std::allocatorCatch::Config; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2]’
/projects/opt/ppc64le/gcc/7.3.0/include/c++/7.3.0/bits/shared_ptr_base.h:637:4: required from ‘std::__shared_count<_Lp>::__shared_count(std::_Sp_make_shared_tag, _Tp*, const _Alloc&, _Args&& ...) [with _Tp = Catch::Config; _Alloc = std::allocatorCatch::Config; _Args = {Catch::ConfigData&}; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2]’
gcc/7.3.0/include/c++/7.3.0/bits/shared_ptr_base.h:1295:35: required from ‘std::__shared_ptr<_Tp, _Lp>::__shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocatorCatch::Config; _Args = {Catch::ConfigData&}; _Tp = Catch::Config; __gnu_cxx::_Lock_policy _Lp = (__gnu_cxx::_Lock_policy)2]’
gcc/7.3.0/include/c++/7.3.0/bits/shared_ptr.h:344:64: required from ‘std::shared_ptr<_Tp>::shared_ptr(std::_Sp_make_shared_tag, const _Alloc&, _Args&& ...) [with _Alloc = std::allocatorCatch::Config; _Args = {Catch::ConfigData&}; _Tp = Catch::Config]’
gcc/7.3.0/include/c++/7.3.0/bits/shared_ptr.h:690:14: required from ‘std::shared_ptr<_Tp> std::allocate_shared(const _Alloc&, _Args&& ...) [with _Tp = Catch::Config; _Alloc = std::allocatorCatch::Config; _Args = {Catch::ConfigData&}]’
gcc/7.3.0/include/c++/7.3.0/bits/shared_ptr.h:706:39: required from ‘std::shared_ptr<_Tp> std::make_shared(_Args&& ...) [with _Tp = Catch::Config; _Args = {Catch::ConfigData&}]’
build/_deps/catch-src/single_include/catch2/catch.hpp:13403:63: required from here
gcc/7.3.0/include/c++/7.3.0/ext/new_allocator.h:136:4: error: invalid new-expression of abstract class type ‘Catch::Config’
{ ::new((void *)__p) _Up(std::forward<_Args>(__args)...); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from test.cpp:3:0:
build/_deps/catch-src/single_include/catch2/catch.hpp:5315:11: note: because the following virtual functions are pure within ‘Catch::Config’:
class Config : public IConfig {
^~~~~~
In file included from test.cpp:3:0:
build/_deps/catch-src/single_include/catch2/catch.hpp:4525:24: note: virtual double Catch::IConfig::minDuration() const
virtual double minDuration() const = 0;

Expected behavior
I would expect this code would compile. In fact, it compiled 1-2 weeks ago.

Reproduction steps
See code above

Platform information:

  • OS: Red Hat 7
  • Compiler+version: GCC v7.3.0
  • Catch version: master
@stvdwtt
Copy link

stvdwtt commented Jul 6, 2020

I'm having the same issue. I can compile with v2.12.2, but not the current master (which I believe is v2.12.4).

OS: Ubuntu 20.02
Compiler: GCC 9.3.0
Catch version: master

@aaaaaaaaargh
Copy link

aaaaaaaaargh commented Jul 6, 2020

I am experiencing the same with Clang 10.0.0:

In file included from [...]/cmake-build-debug/_deps/catch2-src/single_include/catch2/catch.hpp:481: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/string:41: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/allocator.h:46: In file included from /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33: /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/ext/new_allocator.h:150:23: error: allocating an object of abstract class type 'Catch::Config' { ::new((void *)__p) _Up(std::forward<_Args>(__args)...); } ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/alloc_traits.h:512:8: note: in instantiation of function template specialization '__gnu_cxx::new_allocator<Catch::Config>::construct<Catch::Config, Catch::ConfigData &>' requested here __a.construct(__p, std::forward<_Args>(__args)...); ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/shared_ptr_base.h:551:30: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<Catch::Config> >::construct<Catch::Config, Catch::ConfigData &>' requested here allocator_traits<_Alloc>::construct(__a, _M_ptr(), ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/shared_ptr_base.h:683:6: note: in instantiation of function template specialization 'std::_Sp_counted_ptr_inplace<Catch::Config, std::allocator<Catch::Config>, __gnu_cxx::_S_atomic>::_Sp_counted_ptr_inplace<Catch::ConfigData &>' requested here _Sp_cp_type(__a._M_a, std::forward<_Args>(__args)...); ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/shared_ptr_base.h:1371:14: note: in instantiation of function template specialization 'std::__shared_count<__gnu_cxx::_S_atomic>::__shared_count<Catch::Config, std::allocator<Catch::Config>, Catch::ConfigData &>' requested here : _M_ptr(), _M_refcount(_M_ptr, __tag, std::forward<_Args>(__args)...) ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/shared_ptr.h:408:4: note: in instantiation of function template specialization 'std::__shared_ptr<Catch::Config, __gnu_cxx::_S_atomic>::__shared_ptr<std::allocator<Catch::Config>, Catch::ConfigData &>' requested here : __shared_ptr<_Tp>(__tag, std::forward<_Args>(__args)...) ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/shared_ptr.h:859:14: note: in instantiation of function template specialization 'std::shared_ptr<Catch::Config>::shared_ptr<std::allocator<Catch::Config>, Catch::ConfigData &>' requested here return shared_ptr<_Tp>(_Sp_alloc_shared_tag<_Alloc>{__a}, ^ /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/shared_ptr.h:875:19: note: in instantiation of function template specialization 'std::allocate_shared<Catch::Config, std::allocator<Catch::Config>, Catch::ConfigData &>' requested here return std::allocate_shared<_Tp>(std::allocator<_Tp_nc>(), ^ [...]/catch2-src/single_include/catch2/catch.hpp:13403:29: note: in instantiation of function template specialization 'std::make_shared<Catch::Config, Catch::ConfigData &>' requested here m_config = std::make_shared<Config>( m_configData ); ^ [...]/catch2/catch.hpp:4525:24: note: unimplemented pure virtual method 'minDuration' in 'Config' virtual double minDuration() const = 0;

As an additional note, this is only happening in master. I checked with v2.12.4 (latest release as of current date) and everything seems to work fine again.

@bowie7070
Copy link

bowie7070 commented Jul 6, 2020

I'm getting this problem with Visual Studio 2017 on Windows with commit 6f7c191 on master. First bad commit is 46fde0c.

@aaaaaaaaargh
Copy link

aaaaaaaaargh commented Jul 6, 2020

After a short investigation it seems to me that minDuration has been declared in the single header version, while it has only been defined in the non-header-only version. So probably this should fix it.

For me it failed using the header-only include, am I correct to assume this is the case for all others affected by this as well?

Also, @david8dixon it might be a good idea to change the issue title to something less compiler specific as this is clearly not a GCC related problem.

@iWeaker
Copy link

iWeaker commented Jul 6, 2020

Yep, same problem in GCC 9.3
Captura de pantalla de 2020-07-06 15-35-38

@horenmar
Copy link
Member

horenmar commented Jul 7, 2020

Okay, this is fixed. The #1910 contained a partial change to the single-header, which has now been reverted.

Y'all really should be using tags for your CI though.

@aaaaaaaaargh
Copy link

aaaaaaaaargh commented Jul 7, 2020

@horenmar Thank you! In fact I think that most of us are using tags, that's why we know its only broken in master and we have been able to fix our problems by ourselves. We just wanted to notify the project of this problem as this would probably have ended up in a tag sooner or later as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants