Bug 1683339

Summary: __is_alloc_insertable_impl members are private
Product: [Fedora] Fedora Reporter: Mattias Ellert <mattias.ellert>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 30CC: aoliva, davejohansen, dmalcolm, fweimer, jakub, jwakely, law, mpolacek, msebor, nickc
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libstdc++-9.0.1-0.8.fc30 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-03-01 06:27:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1683297    

Description Mattias Ellert 2019-02-26 16:01:47 UTC
Description of problem:

With the update of gcc from 9.0.1-0.4.fc30 to 9.0.1-0.7.fc30 the builds of the root package started failing in koschel:

https://apps.fedoraproject.org/koschei/package/root?collection=f30

The error is:

```
In file included from input_line_5:1:
In file included from /builddir/build/BUILD/root-6.16.00/builddir/include/Rtypes.h:192:
In file included from /builddir/build/BUILD/root-6.16.00/builddir/include/TGenericClassInfo.h:15:
In file included from /usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/vector:65:
In file included from /usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_construct.h:61:
In file included from /usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/ext/alloc_traits.h:36:
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:604:44: error: 'copy' is a protected member of 'std::__is_alloc_insertable_impl'
    : __is_alloc_insertable_impl::template copy<_Alloc>
                                           ^
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:595:7: note: declared protected here
      using copy = decltype(_M_select<_Alloc, const _Tp&>(0));
      ^
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:616:44: error: 'move' is a protected member of 'std::__is_alloc_insertable_impl'
    : __is_alloc_insertable_impl::template move<_Alloc>
                                           ^
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:598:7: note: declared protected here
      using move = decltype(_M_select<_Alloc, _Tp>(0));
      ^
Error: Error loading the default header files.

```

This is related to GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89416

If I apply the change from the commit
https://github.com/gcc-mirror/gcc/commit/c9f61a6
manually in a mock Fedora 30 chroot, the %build part of the rpmbuild command is successful.

However, a few of the tests run in the %check part are still failing with errors like:
```
Processing /builddir/build/BUILD/root-6.16.00/tutorials/dataframe/df016_vecOps.C...
In file included from /builddir/build/BUILD/root-6.16.00/builddir/input_line_3:2:
In file included from /usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/string:55:
In file included from /usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/basic_string.h:40:
In file included from /usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/ext/alloc_traits.h:36:
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:598:29: error: '_M_select' is a private member of 'std::__is_alloc_insertable_impl'
      using move = decltype(_M_select<_Alloc, _Tp>(0));
                            ^~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:616:44: note: in instantiation of template type alias 'move' requested here
    : __is_alloc_insertable_impl::template move<_Alloc>
                                           ^
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/stl_vector.h:446:29: note: in instantiation of template class 'std::__is_move_insertable<ROOT::Detail::VecOps::RAdoptAllocator<double> >' requested here
        return _S_nothrow_relocate(__is_move_insertable<_Tp_alloc_type>{});
                                   ^
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/vector.tcc:76:29: note: in instantiation of member function 'std::vector<double, ROOT::Detail::VecOps::RAdoptAllocator<double> >::_S_use_relocate' requested here
          if _GLIBCXX17_CONSTEXPR (_S_use_relocate())
                                   ^
/builddir/build/BUILD/root-6.16.00/builddir/include/ROOT/RVec.hxx:345:44: note: in instantiation of member function 'std::vector<double, ROOT::Detail::VecOps::RAdoptAllocator<double> >::reserve' requested here
   void reserve(size_type new_cap) { fData.reserve(new_cap); }
                                           ^
/builddir/build/BUILD/root-6.16.00/builddir/include/ROOT/RVec.hxx:315:11: note: in instantiation of member function 'ROOT::VecOps::RVec<double>::reserve' requested here
      ret.reserve(n);
          ^
input_line_25:3:9: note: in instantiation of function template specialization 'ROOT::VecOps::RVec<double>::operator[]<int, std::enable_if<true, void> >' requested here
return y[rInFig]
        ^
/usr/lib/gcc/x86_64-redhat-linux/9/../../../../include/c++/9/bits/alloc_traits.h:587:7: note: implicitly declared private here
      _M_select(int);
      ^
terminate called after throwing an instance of 'std::runtime_error'
  what():  Cannot interpret the following expression:
y[rInFig]
Make sure it is valid C++.
```

Since the error says "implicitly declared private here", I tried to declare that statement public by moving the public qualifier up a few lines:

```
$ diff -u /var/lib/mock/fedora-30-x86_64/root/usr/include/c++/9/bits/alloc_traits.h~ /var/lib/mock/fedora-30-x86_64/root/usr/include/c++/9/bits/alloc_traits.h
--- /var/lib/mock/fedora-30-x86_64/root/usr/include/c++/9/bits/alloc_traits.h~	2019-02-25 11:57:24.736405251 +0100
+++ /var/lib/mock/fedora-30-x86_64/root/usr/include/c++/9/bits/alloc_traits.h	2019-02-26 09:14:19.134757775 +0100
@@ -578,6 +578,7 @@
 
   class __is_alloc_insertable_impl
   {
+  public:
     template<typename _Alloc, typename _Up,
 	     typename _Tp = __remove_cvref_t<_Up>,
 	     typename = decltype(allocator_traits<_Alloc>::construct(
@@ -590,7 +591,6 @@
       static false_type
       _M_select(...);
 
-  public:
     template<typename _Alloc, typename _Tp = typename _Alloc::value_type>
       using copy = decltype(_M_select<_Alloc, const _Tp&>(0));
 
```

With this additional change the full build including the %check section was successful.

Version-Release number of selected component (if applicable):

libstdc++-9.0.1-0.7.fc30

How reproducible:

Always

Steps to Reproduce:
1. Build root package with libstdc++-9.0.1-0.7.fc30

Actual results:

Failed build.
Failing tests with partial fix from upstream VCS applied.

Expected results:

Successful build, including tests.

Additional info:

There was an unrelated build failure in earlier koschei builds where two tests failed on x86_64 only. This was due to issues with blas when compiled with gcc 9. This issue has been fixed.

Comment 1 Jonathan Wakely 2019-02-26 16:30:27 UTC
I'll fix this upstream, thanks.

Comment 2 Jonathan Wakely 2019-02-26 20:44:51 UTC
Fixed upstream now.

Comment 3 Jakub Jelinek 2019-02-28 13:19:28 UTC
Please try gcc-9.0.1-0.8.fc30.

Comment 4 Mattias Ellert 2019-03-01 06:47:39 UTC
Thanks for the quick response.