Repository: opencv
Issue: compiling gapi_async_test.cpp with gcc 11 fails
Labels: bug,category: build/install,confirmed,category: g-api / gapi,category: 3rdparty

##### System information (version)

- OpenCV => master
- Operating System / Platform => Yocto
- Compiler => GCC 11

##### Detailed description

compiling openCV with upcoming GCC11 fails in `modules/gapi/test/gapi_async_test.cpp `

```
In file included from /tmp/xxx/include/c++/11.0.1/vector:66,
                 from /mnt/b/yoe/master/build/tmp/work/armv7vet2hf-neon-yoe-linux-gnueabi/opencv/4.5.1-r0/git/modules/gapi/test/test_precomp.hpp:15,
                 from /mnt/b/yoe/master/build/tmp/work/armv7vet2hf-neon-yoe-linux-gnueabi/opencv/4.5.1-r0/git/modules/gapi/test/gapi_async_test.cpp:8:
/tmp/xxx/include/c++/11.0.1/bits/stl_uninitialized.h: In instantiation of ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::move_iterator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>*>; _ForwardIterator = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>*]’:
/tmp/xxx/include/c++/11.0.1/bits/stl_uninitialized.h:332:37:   required from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::move_iterator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>*>; _ForwardIterator = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>*; _Tp = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>]’
/tmp/xxx/include/c++/11.0.1/bits/stl_vector.h:1514:35:   required from ‘std::vector<_Tp, _Alloc>::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::vector<_Tp, _Alloc>::size_type, _ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::move_iterator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>*>; _Tp = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>; _Alloc = std::allocator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply> >; std::vector<_Tp, _Alloc>::pointer = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>*; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
/tmp/xxx/include/c++/11.0.1/bits/vector.tcc:85:36:   required from ‘void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>; _Alloc = std::allocator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
/mnt/b/yoe/master/build/tmp/work/armv7vet2hf-neon-yoe-linux-gnueabi/opencv/4.5.1-r0/git/modules/gapi/test/gapi_async_test.cpp:362:54:   required from ‘void opencv_test::gtest_case_cancel_::basic<gtest_TypeParam_>::TestBody() [with gtest_TypeParam_ = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncApply>]’
/mnt/b/yoe/master/build/tmp/work/armv7vet2hf-neon-yoe-linux-gnueabi/opencv/4.5.1-r0/git/modules/gapi/test/gapi_async_test.cpp:359:1:   required from here
/tmp/xxx/include/c++/11.0.1/bits/stl_uninitialized.h:137:72: error: static assertion failed: result type must be constructible from value type of input range
  137 |       static_assert(is_constructible<_ValueType2, decltype(*__first)>::value,
      |                                                                        ^~~~~
/tmp/xxx/include/c++/11.0.1/bits/stl_uninitialized.h:137:72: note: ‘std::integral_constant<bool, false>::value’ evaluates to false
/tmp/xxx/include/c++/11.0.1/bits/stl_uninitialized.h: In instantiation of ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = std::move_iterator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>*>; _ForwardIterator = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>*]’:
/tmp/xxx/include/c++/11.0.1/bits/stl_uninitialized.h:332:37:   required from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::move_iterator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>*>; _ForwardIterator = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>*; _Tp = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>]’
/tmp/xxx/include/c++/11.0.1/bits/stl_vector.h:1514:35:   required from ‘std::vector<_Tp, _Alloc>::pointer std::vector<_Tp, _Alloc>::_M_allocate_and_copy(std::vector<_Tp, _Alloc>::size_type, _ForwardIterator, _ForwardIterator) [with _ForwardIterator = std::move_iterator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>*>; _Tp = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>; _Alloc = std::allocator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled> >; std::vector<_Tp, _Alloc>::pointer = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>*; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
/tmp/xxx/include/c++/11.0.1/bits/vector.tcc:85:36:   required from ‘void std::vector<_Tp, _Alloc>::reserve(std::vector<_Tp, _Alloc>::size_type) [with _Tp = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>; _Alloc = std::allocator<opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int]’
/mnt/b/yoe/master/build/tmp/work/armv7vet2hf-neon-yoe-linux-gnueabi/opencv/4.5.1-r0/git/modules/gapi/test/gapi_async_test.cpp:362:54:   required from ‘void opencv_test::gtest_case_cancel_::basic<gtest_TypeParam_>::TestBody() [with gtest_TypeParam_ = opencv_test::Case<opencv_test::SelfCanceling, opencv_test::CallBack, opencv_test::AsyncCompiled>]’
/mnt/b/yoe/master/build/tmp/work/armv7vet2hf-neon-yoe-linux-gnueabi/opencv/4.5.1-r0/git/modules/gapi/test/gapi_async_test.cpp:359:1:   required from here
/tmp/xxx/include/c++/11.0.1/bits/stl_uninitialized.h:137:72: error: static assertion failed: result type must be constructible from value type of input range
/tmp/xxx/include/c++/11.0.1/bits/stl_uninitialized.h:137:72: note: ‘std::integral_constant<bool, false>::value’ evaluates to false

```

##### Steps to reproduce

install gcc11 on fedora/debian

preprocessed Testcase (gc11) is  here https://uclibc.org/~kraj/a.i.tar.xz
gcc10 - https://uclibc.org/~kraj/a.i-gcc10.tar.xz
```
g++ -O2 -c a.i -fpermissive
```
above works ok with gcc10 but fails as stated above with gcc11