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
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::allocator
/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::allocator
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::allocator
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::allocator
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::allocator
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:
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
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.
I'm getting this problem with Visual Studio 2017 on Windows with commit 6f7c191513bac7ea0cb95a3b11011e471be777c0 on master. First bad commit is 46fde0c5978d0c138f9309a4cebfc8ff9c44e286.
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.
Yep, same problem in GCC 9.3

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.
@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.
Most helpful comment
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.