Bug 1485641 - Boost ICL compile error with GCC and C++17
Summary: Boost ICL compile error with GCC and C++17
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: boost
Version: 26
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jonathan Wakely
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-26 15:05 UTC by Georg Sauthoff
Modified: 2017-11-23 14:01 UTC (History)
4 users (show)

Fixed In Version: boost-1.63.0-7.fc26 boost-1.64.0-2.fc27
Clone Of:
Environment:
Last Closed: 2017-09-15 22:24:18 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Georg Sauthoff 2017-08-26 15:05:08 UTC
Description of problem:
Compiling a program that includes a Boost ICL (interval container library) yields an error when C++17 is selected. It works when using other standard switches (e.g. C++14).


Version-Release number of selected component (if applicable):
boost-devel-1.63.0-6.fc26.x86_64

How reproducible:
always

Steps to Reproduce:
1. $ cat > test_icl.cc 
#include <boost/icl/interval_set.hpp>

int main()
{
  return 0;
}
2. $ g++ -std=c++1z test_icl.cc
3.

Actual results:
In file included from /usr/include/boost/icl/type_traits/identity_element.hpp:11:0,
                 from /usr/include/boost/icl/type_traits/unit_element.hpp:12,
                 from /usr/include/boost/icl/concept/interval.hpp:17,
                 from /usr/include/boost/icl/concept/joinable.hpp:12,
                 from /usr/include/boost/icl/associative_interval_container.hpp:13,
                 from /usr/include/boost/icl/interval_base_set.hpp:24,
                 from /usr/include/boost/icl/interval_set.hpp:14,
                 from test_icl.cc:1:
/usr/include/boost/icl/type_traits/type_to_string.hpp:56:12: error: partial specialization of ‘struct boost::icl::type_to_string<Unary<Type> >’ after instantiation of ‘struct boost::icl::type_to_string<std::__cxx11::basic_string<char> >’ [-fpermissive]
     struct type_to_string<Unary<Type> >
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/boost/icl/type_traits/type_to_string.hpp:72:12: error: partial specialization of ‘struct boost::icl::type_to_string<Binary<Type1, Type2> >’ after instantiation of ‘struct boost::icl::type_to_string<std::__cxx11::basic_string<char> >’ [-fpermissive]
     struct type_to_string<Binary<Type1, Type2> >
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Expected results:
No error output, successful compilation.

Additional info:

What does work:

$ g++ -std=c++14 test_icl.cc


Unfortunately, although clang++ has some C++17 support, it can't be used as a drop-in replacement, because it hasn't enough support for compiling libstdc++ std::optional implementation which is included by Boost ICL:

$ clang++ -std=c++1z test_icl.cc
In file included from test_icl.cc:1:
In file included from /usr/include/boost/icl/interval_set.hpp:14:
In file included from /usr/include/boost/icl/interval_base_set.hpp:19:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/set:60:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/stl_tree.h:72:
In file included from /usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/node_handle.h:39:
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/optional:1032:27: error: use of class template 'optional' requires template arguments
  template <typename _Tp> optional(_Tp) -> optional<_Tp>;
                          ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/optional:451:11: note: template is declared here
    class optional
          ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/optional:1032:40: error: expected ';' at end of declaration
  template <typename _Tp> optional(_Tp) -> optional<_Tp>;
                                       ^
/usr/bin/../lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/optional:1032:41: error: cannot use arrow operator on a type
  template <typename _Tp> optional(_Tp) -> optional<_Tp>;
                                        ^
3 errors generated.

Comment 1 Jonathan Wakely 2017-09-11 15:30:38 UTC
The Boost.ICL library is not compatible with GCC's C++17 mode. The problem can be demonstrated by:

template<typename T, typename U = void> struct S { };

template<typename T> struct X { static void f(); };

template<> inline void X<S<char>>::f() { }

template<template<class> class Unary, typename T> struct X<Unary<T>>
{ static void f() { } };

In C++17 mode GCC implements the proposed changes from https://wg21.link/p0522r0

This behaviour of GCC is controlled by the -fnew-ttp-matching switch, which is enabled by default for C++17 mode. You can use -fno-new-ttp-matching to compile code using Boost.ICL in C++17 mode.

I'll consider patching the Boost header to reorder the partial specializations, so that the std::string specialization is valid even with -fnewttp-matching enabled.

Comment 2 Fedora Update System 2017-09-12 22:47:32 UTC
boost-1.63.0-7.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-2638823431

Comment 3 Fedora Update System 2017-09-12 22:47:41 UTC
boost-1.64.0-2.fc27 has been submitted as an update to Fedora 27. https://bodhi.fedoraproject.org/updates/FEDORA-2017-8eb1196657

Comment 4 Fedora Update System 2017-09-13 19:24:07 UTC
boost-1.64.0-2.fc27 has been pushed to the Fedora 27 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-8eb1196657

Comment 5 Fedora Update System 2017-09-14 04:52:38 UTC
boost-1.63.0-7.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-2638823431

Comment 6 Fedora Update System 2017-09-15 22:24:18 UTC
boost-1.63.0-7.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.

Comment 7 Fedora Update System 2017-09-30 06:26:54 UTC
boost-1.64.0-2.fc27 has been pushed to the Fedora 27 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.